mirror of https://github.com/MISP/misp-bump
add dynamic role assignment
parent
b8f850f163
commit
8f2de6787d
|
@ -20,6 +20,7 @@ import lu.circl.mispbump.auxiliary.PreferenceManager;
|
|||
import lu.circl.mispbump.customViews.ProgressActionView;
|
||||
import lu.circl.mispbump.models.SyncInformation;
|
||||
import lu.circl.mispbump.models.restModels.Organisation;
|
||||
import lu.circl.mispbump.models.restModels.Role;
|
||||
import lu.circl.mispbump.models.restModels.Server;
|
||||
import lu.circl.mispbump.models.restModels.User;
|
||||
|
||||
|
@ -156,9 +157,15 @@ public class UploadActivity extends AppCompatActivity {
|
|||
User syncUser = syncInformation.getRemote().getSyncUser();
|
||||
|
||||
syncUser.setOrgId(organisation.getId());
|
||||
syncUser.setRoleId(6);
|
||||
syncUser.setTermsAccepted(true);
|
||||
|
||||
Role[] roles = preferenceManager.getRoles();
|
||||
for (Role role : roles) {
|
||||
if (role.isSyncUserRole()) {
|
||||
syncUser.setRoleId(role.getId());
|
||||
}
|
||||
}
|
||||
|
||||
return syncUser;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,13 @@ public class Role {
|
|||
@SerializedName("permission_description")
|
||||
private String permissionDescription;
|
||||
|
||||
|
||||
public boolean isSyncUserRole() {
|
||||
return permSync && permAuth && permTagger && permTagEditor && permSharingGroup
|
||||
&& permDelegate && permSighting && permPublishZmq && permPublishKafka;
|
||||
}
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue