Browse Source

Demo mode: the profiles must be in read-only mode (it is not enough to have the users in read-only)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3203 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 năm trước cách đây
mục cha
commit
2d3ea0cbe5
1 tập tin đã thay đổi với 19 bổ sung0 xóa
  1. 19 0
      addons/userrights/userrightsprofile.class.inc.php

+ 19 - 0
addons/userrights/userrightsprofile.class.inc.php

@@ -210,6 +210,25 @@ class URP_Profiles extends UserRightsBaseClassGUI
 			$oLnk->DBDelete();
 		}
 	}
+
+	/**
+	 * Returns the set of flags (OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY...)
+	 * for the given attribute in the current state of the object
+	 * @param $sAttCode string $sAttCode The code of the attribute
+	 * @param $aReasons array To store the reasons why the attribute is read-only (info about the synchro replicas)
+	 * @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used
+	 * @return integer Flags: the binary combination of the flags applicable to this attribute
+	 */	 	  	 	
+	public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
+	{
+		$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
+		if (MetaModel::GetConfig()->Get('demo_mode'))
+		{
+			$aReasons[] = 'Sorry, profiles are read-only in the demonstration mode!';
+			$iFlags |= OPT_ATT_READONLY;
+		}
+		return $iFlags;
+	}
 }