소스 검색

- Enforce users to be created with at least one profile

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@867 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 년 전
부모
커밋
5408b4770d
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      core/userrights.class.inc.php

+ 8 - 4
core/userrights.class.inc.php

@@ -130,6 +130,14 @@ abstract class User extends cmdbAbstractObject
 				$this->m_aCheckIssues[] = Dict::Format('Class:User/Error:LoginMustBeUnique', $sNewLogin);
 			}
 		}
+		// Check that this user has at least one profile assigned
+		$oSet = $this->Get('profile_list');
+		$aProfileLinks = $oSet->ToArray();
+		if (count($aProfileLinks) == 0)
+		{
+			$this->m_aCheckIssues[] = Dict::Format('Class:User/Error:AtLeastOneProfileIsNeeded');
+		}
+		
 	}
 
 	function GetGrantAsHtml($sClass, $iAction)
@@ -584,10 +592,6 @@ class UserRights
 			}
 			return self::$m_oAddOn->IsStimulusAllowed($oUser, $sClass, $sStimulusCode, $oInstanceSet);
 		}
-		elseif(($iActionCode == UR_ACTION_READ) && MetaModel::HasCategory($sClass, 'view_in_gui'))
-		{
-			return true;
-		}
 		else
 		{
 			// Other classes could be edited/listed by the administrators