[Profile] Allow grantRole to work when role exists
This commit is contained in:
parent
535b87bb64
commit
15f7941daf
@ -1162,7 +1162,10 @@ class Profile extends Managed_DataObject
|
||||
$role->role = $name;
|
||||
$role->created = common_sql_now();
|
||||
|
||||
$result = $role->insert();
|
||||
$result = $role->update();
|
||||
if ($result === 0 || $result === false) {
|
||||
$result = $role->insert();
|
||||
}
|
||||
|
||||
if (!$result) {
|
||||
throw new Exception("Can't save role '$name' for profile '{$this->id}'");
|
||||
|
Loading…
Reference in New Issue
Block a user