Beispiel #1
0
void Permission::removeRole(unsigned role_idx)
{
	if(role_idx > roles.size())
		throw Exception(ERR_REF_OBJ_INV_INDEX,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	generatePermissionId();
}
Beispiel #2
0
void Permission::removeRole(unsigned role_idx)
{
	if(role_idx > roles.size())
		throw Exception(ERR_REF_OBJ_INV_INDEX,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	roles.erase(roles.begin() + role_idx);
	generatePermissionId();
	setCodeInvalidated(true);
}
Beispiel #3
0
void Permission::setPrivilege(unsigned priv_id, bool value, bool grant_op)
{
	//Caso o tipo de privilégio sejá inválido dispara uma exceção
	if(priv_id > PRIV_USAGE)
		throw Exception(ERR_REF_INV_PRIVILEGE_TYPE,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	if(!objectAcceptsPermission(object->getObjectType(), priv_id))
		//Raises an error if the privilege is invalid according to the object type
		throw Exception(ERR_ASG_INCOMP_PRIV_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	privileges[priv_id]=value;
	this->grant_option[priv_id]=grant_op;
	generatePermissionId();
}
Beispiel #4
0
void Permission::addRole(Role *role)
{
	//Raises an error if the role is not allocated
	if(!role)
		throw Exception(ERR_ASG_NOT_ALOC_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	//Raises an error if the role already exists in the permission
	if(isRoleExists(role))
		throw Exception(ERR_INS_DUP_ROLE_PERMISSION,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	roles.push_back(role);

	//Updates the permission Id
	generatePermissionId();
}
Beispiel #5
0
void Permission::removeRoles(void)
{
	roles.clear();
	generatePermissionId();
}
Beispiel #6
0
void Permission::removeRoles(void)
{
	roles.clear();
	generatePermissionId();
	setCodeInvalidated(true);
}