本文整理汇总了PHP中RightsUtil::getAllModuleRightsDataByPermitable方法的典型用法代码示例。如果您正苦于以下问题:PHP RightsUtil::getAllModuleRightsDataByPermitable方法的具体用法?PHP RightsUtil::getAllModuleRightsDataByPermitable怎么用?PHP RightsUtil::getAllModuleRightsDataByPermitable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RightsUtil
的用法示例。
在下文中一共展示了RightsUtil::getAllModuleRightsDataByPermitable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEditRights
public function actionEditRights($id)
{
$group = Group::getById(intval($id));
$title = Zurmo::t('ZurmoModule', 'Rights');
$breadCrumbLinks = array(strval($group) => array('group/' . static::resolveBreadCrumbActionByGroup($group), 'id' => $id), $title);
$rightsData = RightsUtil::getAllModuleRightsDataByPermitable($group);
$rightsForm = RightsFormUtil::makeFormFromRightsData($rightsData);
$postVariableName = get_class($rightsForm);
if (isset($_POST[$postVariableName])) {
$castedPostData = RightsFormUtil::typeCastPostData($_POST[$postVariableName]);
if (RightsFormUtil::setRightsFromCastedPost($castedPostData, $group)) {
$this->clearCaches();
$group->forget();
$group = Group::getById(intval($id));
Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Rights Saved Successfully.'));
$action = $this->resolveActionToGoToAfterSave($group);
$this->redirect(array($this->getId() . '/' . $action, 'id' => $group->id));
Yii::app()->end(0, false);
}
}
$metadata = RightsEditViewUtil::resolveMetadataFromData($rightsForm->data, RightsEditAndDetailsView::getMetadata());
$titleBarAndEditView = new GroupActionBarAndSecurityEditView($this->getId(), $this->getModule()->getId(), $rightsForm, $group, $this->getModule()->getPluralCamelCasedName(), $metadata, 'RightsEditAndDetailsView', 'GroupRightsEditMenu');
$view = new GroupsPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $titleBarAndEditView, $breadCrumbLinks, 'GroupBreadCrumbView'));
echo $view->render();
}
示例2: actionSecurityDetails
public function actionSecurityDetails($id)
{
UserAccessUtil::resolveCanCurrentUserAccessAction(intval($id));
$user = User::getById(intval($id));
UserAccessUtil::resolveCanCurrentUserAccessRootUser($user);
UserAccessUtil::resolveAccessingASystemUser($user);
$title = Zurmo::t('UsersModule', 'Security Overview');
$breadCrumbLinks = array(strval($user) => array('default/details', 'id' => $id), $title);
$modulePermissionsData = PermissionsUtil::getAllModulePermissionsDataByPermitable($user);
$modulePermissionsForm = ModulePermissionsFormUtil::makeFormFromPermissionsData($modulePermissionsData);
$viewReadyModulePermissionsData = GroupModulePermissionsDataToEditViewAdapater::resolveData($modulePermissionsData);
$modulePermissionsViewMetadata = ModulePermissionsActualDetailsViewUtil::resolveMetadataFromData($viewReadyModulePermissionsData, ModulePermissionsEditAndDetailsView::getMetadata());
$rightsData = RightsUtil::getAllModuleRightsDataByPermitable($user);
$rightsForm = RightsFormUtil::makeFormFromRightsData($rightsData);
$rightsViewMetadata = RightsEffectiveDetailsViewUtil::resolveMetadataFromData($rightsData, RightsEditAndDetailsView::getMetadata());
$policiesData = PoliciesUtil::getAllModulePoliciesDataByPermitable($user);
$policiesForm = PoliciesFormUtil::makeFormFromPoliciesData($policiesData);
$policiesViewMetadata = PoliciesEffectiveDetailsViewUtil::resolveMetadataFromData($policiesData, PoliciesEditAndDetailsView::getMetadata());
$groupMembershipAdapter = new UserGroupMembershipToViewAdapter($user);
$groupMembershipViewData = $groupMembershipAdapter->getViewData();
$securityDetailsView = new UserActionBarAndSecurityDetailsView($this->getId(), $this->getModule()->getId(), $user, $modulePermissionsForm, $rightsForm, $policiesForm, $modulePermissionsViewMetadata, $rightsViewMetadata, $policiesViewMetadata, $groupMembershipViewData);
$view = new UsersPageView($this->resolveZurmoDefaultOrAdminView($securityDetailsView, $breadCrumbLinks, 'UserBreadCrumbView'));
echo $view->render();
}
示例3: testRightsFormUtilSetRightsFromPost
/**
* @depends testRightsFormUtil
*/
public function testRightsFormUtilSetRightsFromPost()
{
$group = Group::getByName('viewGroup');
$data = RightsUtil::getAllModuleRightsDataByPermitable($group);
$form = RightsFormUtil::makeFormFromRightsData($data);
$compareData = array('UsersModule' => array('RIGHT_CHANGE_USER_PASSWORDS' => array('displayName' => UsersModule::RIGHT_CHANGE_USER_PASSWORDS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_LOGIN_VIA_WEB' => array('displayName' => 'Sign in Via Web', 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_LOGIN_VIA_MOBILE' => array('displayName' => 'Sign in Via Mobile', 'explicit' => Right::ALLOW, 'inherited' => null, 'effective' => Right::ALLOW), 'RIGHT_LOGIN_VIA_WEB_API' => array('displayName' => 'Sign in Via Web API', 'explicit' => null, 'inherited' => Right::ALLOW, 'effective' => Right::ALLOW), 'RIGHT_CREATE_USERS' => array('displayName' => UsersModule::RIGHT_CREATE_USERS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_ACCESS_USERS' => array('displayName' => UsersModule::RIGHT_ACCESS_USERS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY)));
$this->assertEquals($compareData['UsersModule'], $form->data['UsersModule']);
$fakePost = array('UsersModule__RIGHT_LOGIN_VIA_WEB_API' => strval(Right::ALLOW), 'UsersModule__RIGHT_LOGIN_VIA_MOBILE' => '', 'UsersModule__RIGHT_LOGIN_VIA_WEB' => strval(Right::DENY));
$fakePost = RightsFormUtil::typeCastPostData($fakePost);
$saved = RightsFormUtil::setRightsFromCastedPost($fakePost, $group);
$this->assertTrue($saved);
$group->forget();
$group = Group::getByName('viewGroup');
$compareData = array('UsersModule' => array('RIGHT_CHANGE_USER_PASSWORDS' => array('displayName' => UsersModule::RIGHT_CHANGE_USER_PASSWORDS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_LOGIN_VIA_WEB' => array('displayName' => 'Sign in Via Web', 'explicit' => Right::DENY, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_LOGIN_VIA_MOBILE' => array('displayName' => 'Sign in Via Mobile', 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_LOGIN_VIA_WEB_API' => array('displayName' => 'Sign in Via Web API', 'explicit' => Right::ALLOW, 'inherited' => Right::ALLOW, 'effective' => Right::ALLOW), 'RIGHT_CREATE_USERS' => array('displayName' => UsersModule::RIGHT_CREATE_USERS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY), 'RIGHT_ACCESS_USERS' => array('displayName' => UsersModule::RIGHT_ACCESS_USERS, 'explicit' => null, 'inherited' => null, 'effective' => Right::DENY)));
$data = RightsUtil::getAllModuleRightsDataByPermitable($group);
$this->assertEquals($compareData['UsersModule'], $data['UsersModule']);
$group->forget();
}