Skip to content

Commit

Permalink
closes #882
Browse files Browse the repository at this point in the history
  • Loading branch information
ppazos committed Mar 7, 2018
1 parent e704682 commit 90466b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ gr_account.save(failOnError:true, flush:true)
),
new Plan(
name: "Testing",
max_organizations: 3,
max_organizations: 5,
max_opts_per_organization: 3,
max_api_tokens_per_organization: 3,
repo_total_size_in_kb: 2000, // low for testing! (1MB in KB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ class OrganizationController {

def commit_logs_repo = new File(config.commit_logs.withTrailSeparator() + organizationInstance.uid)
commit_logs_repo.mkdir()



def accman_associated = false // prevents associating the accman twice if the current user is accman
if (SpringSecurityUtils.ifAllGranted("ROLE_ADMIN"))
{
// assign org to admin only if admin choose to
Expand All @@ -228,9 +229,20 @@ class OrganizationController {
{
// Assign org to logged user
// uses the higher role on the current org to assign on the new org
UserRole.create( user, user.getHigherAuthority(session.organization), organizationInstance, true )
def higher_role_in_current_org = user.getHigherAuthority(session.organization)

UserRole.create( user, higher_role_in_current_org, organizationInstance, true )

if (higher_role_in_current_org.authority == Role.AM) accman_associated = true
}

// create accman userrole for the account contact
if (!accman_associated)
{
UserRole.create( account.contact, (Role.findByAuthority(Role.AM)), organizationInstance, true )
}


flash.message = message(code: 'default.created.message', args: [message(code: 'organization.label', default: 'Organization'), organizationInstance.id])
redirect action:'show', params:[uid:organizationInstance.uid]
}
Expand Down

0 comments on commit 90466b2

Please sign in to comment.