Performs the permissions check.
359317
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_update_topics_to_normal_topics(obj, user)
110663
public void checkPermission(Permission perm, AddOnModel addOnModel) throws IzouPermissionException {
        try {
            rootPermission.checkPermission(perm, addOnModel);
            //its root
            return;
        } catch (IzouPermissionException ignored) {
            //its just not root
        }
        standardCheck.stream()
                .filter(permissionModule -> permissionModule.canCheckPermission(perm))
                .forEach(permissionModule -> permissionModule.checkPermission(perm, addOnModel));
    }
490782
def check_user_permissions(payload, user_pk):
    """"""
    for perm_type in ['add', 'remove']:
        user_pks = payload.get('users', {}).get(perm_type, {}).keys()
        if user_pk in user_pks:
            raise exceptions.PermissionDenied("You cannot change your own permissions")
1333543
def has_permission?(*levels)
      if levels.all? { |level| permissions.include? level.to_sym }
        return true
      else
        return false
      end
    end
958768
final public static function checkPermission()
    {
        $base =  __DIR__."/../../";
        if (!self::checkIsExecutable($base."elements/") ||
            !self::checkIsReadable($base."elements/") || !self::checkIsWritable($base."elements/")) {
            return (json_encode(array("code" => 500, "results" => "NOK", "wr" => "elements", "msg" =>
                "Folder elements/ does not have correct permission. Must be read, write, executable permission")));
        }

        if (!self::checkIsExecutable($base."apps/") || !self::checkIsReadable($base."apps/") ||
            !self::checkIsWritable($base."apps/")) {
            return (json_encode(array("code" => 500, "results" => "NOK", "wr" => "apps/", "msg" =>
                "Folder apps/ does not have correct permission. Must be read, write, executable permission")));
        }

        if (!self::checkIsExecutable($base."vendor/") || !self::checkIsReadable($base."vendor/") ||
            !self::checkIsWritable($base."vendor/")) {
            return (json_encode(array("code" => 500, "results" => "NOK", "wr" => "vendor/", "msg" =>
                "Folder vendor/ does not have correct permission. Must be read, write, executable permission")));
        }

        if (!self::checkIsExecutable($base."public/components/libs") ||
            !self::checkIsReadable($base."public/components/libs") ||
            !self::checkIsWritable($base."public/components/libs")) {
            return (json_encode(array("code" => 500, "results" => "NOK", "wr" => "public/components/libs/", "msg" =>
                "Folder public/components/libs/ does not have correct permission. 
                Must be read, write, executable permissions")));
        }

        return (json_encode(array("code" => 200, "results" => "OK")));
    }
163021
private function scanRolesAndPermissions(): void
    {
        $files = $this->helper->getConfigFilesSorted();

        if (!empty($files)) {
            foreach ($files as $filePath) {
                $config = json_decode(file_get_contents($filePath), true);

                if (is_null($config)) {
                    $this->info('Invalid json file: ' . $filePath);
                } else {
                    $packageName = Arr::get($config, 'general.packageName');

                    if (is_null($packageName)) {
                        $this->error('SKIPPING! Package must have a name! file: ' . $filePath);
                        continue;
                    }

                    if (array_key_exists('acl', $config)) {
                        $this->aclData[] = [
                            'packageName' => $packageName,
                            'acl' => Arr::get($config, 'acl'),
                        ];
                    }
                }
            }
        }
    }
9238
def check_permission(self, obj_id, permissions):
        
        response = self._client.session.post(
            '{url}/{id}/permissioncheck'.format(
                url=self.endpoint_url, id=obj_id
            ),
            data={'permissions': permissions}
        )
        return self.process_response(response)
275862
public static function check() {
		if (R::count("permission") < 1) {
			$role       = R::dispense("permission");
			$role->name = "guest";
			R::store($role);
		}
	}
298497
def check_public_permissions(payload):
    """"""
    allowed_public_permissions = ['view', 'add', 'download']
    for perm_type in ['add', 'remove']:
        for perm in payload.get('public', {}).get(perm_type, []):
            if perm not in allowed_public_permissions:
                raise exceptions.PermissionDenied("Permissions for public users are too open")
738629
public function bootPermissions()
    {
        foreach ($this->permissions as $token => $permission) {
            $this->permissions[$token] = sprintf($permission, Str::kebab($this->getManager()->getName()), Str::kebab($this->getName()));
        }
    }
1309234
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_subscribe_to_topic(obj, user)
976484
def print_permissions(permissions):
    """"""

    table = formatting.Table(['keyName', 'Description'])
    for perm in permissions:
        table.add_row([perm['keyName'], perm['name']])
    return table
808897
private static void checkPermission(final Subject user, 
                                      final Permission... permissions) 
  throws AuthorizationException {
    try{
      Subject.doAs(user, 
                   new PrivilegedExceptionAction<Void>() {
                     @Override
                     public Void run() throws Exception {
                       try {
                         for(Permission permission : permissions) {
                           AccessController.checkPermission(permission);
                         }
                       } catch (AccessControlException ace) {
                         LOG.info("Authorization failed for " + 
                                  UserGroupInformation.getCurrentUGI(), ace);
                         throw new AuthorizationException(ace);
                       }
                      return null;
                     }
                   }
                  );
    } catch (PrivilegedActionException e) {
      throw new AuthorizationException(e.getException());
    }
  }
1183934
def check_permission(instance, field, permission):
    
    if not get_permission_test(instance, field, permission)(instance):
        raise PermissionDeniedError(permission, instance, instance, field)
174641
static boolean shouldShowRequestPermissionRationale(Activity activity, String... permissions) {
    for (String permission : permissions) {
      if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
        return true;
      }
    }
    return false;
  }
1234735
@Override
	public synchronized boolean checkPermission(Principal principal, Permission permission)
	{

		if (principal == null)
			return false;

		if (permission == null)
			return false;

		Set<AccessControl> set = this.entries.get(principal);

		if (set != null && !set.isEmpty())
		{
			for (AccessControl accessControl: set)
			{
				if (accessControl.checkPermission(permission))
					return true;
			}
		}

		// did not find for user, not check for groups
		if (SecurityUser.class.isAssignableFrom(principal.getClass()))
		{
			return checkPermission(((SecurityUser) principal).getGroups(), permission);
		}
		return false;
	}
575520
def check_permission(self, request, page, permission):
        
        if not getattr(page, "can_" + permission)(request):
            raise PermissionDenied