mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker
This feature allows root administrators to define new roles and associate API permissions to them. A limited form of role-based access control for the CloudStack management server API is provided through a properties file, commands.properties, embedded in the WAR distribution. Therefore, customizing API permissions requires unpacking the distribution and modifying this file consistently on all servers. The old system also does not permit the specification of additional roles. FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following changes, features and use-cases: - Moves the API access definitions from commands.properties to the mgmt server DB - Allows defining custom roles (such as a read-only ROOT admin) beyond the current set of four (4) roles - All roles will resolve to one of the four known roles types (Admin, Resource Admin, Domain Admin and User) which maintains this association by requiring all new defined roles to specify a role type. - Allows changes to roles and API permissions per role at runtime including additions or removal of roles and/or modifications of permissions, without the need of restarting management server(s) Upgrade/installation notes: - The feature will be enabled by default for new installations, existing deployments will continue to use the older static role based api access checker with an option to enable this feature - During fresh installation or upgrade, the upgrade paths will add four default roles based on the four default role types - For ease of migration, at the time of upgrade commands.properties will be used to add existing set of permissions to the default roles. cloud.account will have a new role_id column which will be populated based on default roles as well Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py - Allows admins to migrate to the dynamic role based checker at a future date - Performs a harder one-way migrate and update - Migrates rules from existing commands.properties file into db and deprecates it - Enables an internal hidden switch to enable dynamic role based checker feature Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
95abb6efc3
commit
4347776ac6
@ -36,10 +36,10 @@ env:
|
|||||||
- REGRESSION_INDEX=6
|
- REGRESSION_INDEX=6
|
||||||
- PATH=$HOME/.local/bin:$PATH
|
- PATH=$HOME/.local/bin:$PATH
|
||||||
matrix:
|
matrix:
|
||||||
- TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range"
|
- TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_dynamicroles smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range"
|
||||||
- TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_list_ids_parameter smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan"
|
- TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_list_ids_parameter smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan"
|
||||||
- TESTS="smoke/test_over_provisioning smoke/test_password_server smoke/test_portable_publicip smoke/test_primary_storage smoke/test_privategw_acl smoke/test_public_ip_range smoke/test_pvlan smoke/test_regions smoke/test_reset_vm_on_reboot smoke/test_resource_detail"
|
- TESTS="smoke/test_over_provisioning smoke/test_password_server smoke/test_portable_publicip smoke/test_primary_storage smoke/test_privategw_acl smoke/test_public_ip_range smoke/test_pvlan smoke/test_regions smoke/test_reset_vm_on_reboot smoke/test_resource_detail"
|
||||||
- TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates"
|
- TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_staticroles smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates"
|
||||||
- TESTS="smoke/test_usage_events smoke/test_vm_life_cycle smoke/test_vm_snapshots smoke/test_volumes smoke/test_vpc_redundant smoke/test_vpc_router_nics smoke/test_vpc_vpn smoke/misc/test_deploy_vm smoke/misc/test_vm_ha smoke/misc/test_escalations_templates smoke/misc/test_vm_sync"
|
- TESTS="smoke/test_usage_events smoke/test_vm_life_cycle smoke/test_vm_snapshots smoke/test_volumes smoke/test_vpc_redundant smoke/test_vpc_router_nics smoke/test_vpc_vpn smoke/misc/test_deploy_vm smoke/misc/test_vm_ha smoke/misc/test_escalations_templates smoke/misc/test_vm_sync"
|
||||||
|
|
||||||
- TESTS="component/test_mm_max_limits component/test_acl_isolatednetwork_delete"
|
- TESTS="component/test_mm_max_limits component/test_acl_isolatednetwork_delete"
|
||||||
|
|||||||
@ -66,6 +66,8 @@ import com.cloud.user.User;
|
|||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicSecondaryIp;
|
import com.cloud.vm.NicSecondaryIp;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
import org.apache.cloudstack.config.Configuration;
|
import org.apache.cloudstack.config.Configuration;
|
||||||
import org.apache.cloudstack.usage.Usage;
|
import org.apache.cloudstack.usage.Usage;
|
||||||
|
|
||||||
@ -166,6 +168,14 @@ public class EventTypes {
|
|||||||
public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
|
public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
|
||||||
public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
|
public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
|
||||||
|
|
||||||
|
// Role events
|
||||||
|
public static final String EVENT_ROLE_CREATE = "ROLE.CREATE";
|
||||||
|
public static final String EVENT_ROLE_UPDATE = "ROLE.UPDATE";
|
||||||
|
public static final String EVENT_ROLE_DELETE = "ROLE.DELETE";
|
||||||
|
public static final String EVENT_ROLE_PERMISSION_CREATE = "ROLE.PERMISSION.CREATE";
|
||||||
|
public static final String EVENT_ROLE_PERMISSION_UPDATE = "ROLE.PERMISSION.UPDATE";
|
||||||
|
public static final String EVENT_ROLE_PERMISSION_DELETE = "ROLE.PERMISSION.DELETE";
|
||||||
|
|
||||||
// Account events
|
// Account events
|
||||||
public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
|
public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
|
||||||
public static final String EVENT_ACCOUNT_DISABLE = "ACCOUNT.DISABLE";
|
public static final String EVENT_ACCOUNT_DISABLE = "ACCOUNT.DISABLE";
|
||||||
@ -605,6 +615,14 @@ public class EventTypes {
|
|||||||
entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class);
|
entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class);
|
||||||
entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class);
|
entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class);
|
||||||
|
|
||||||
|
// Role events
|
||||||
|
entityEventDetails.put(EVENT_ROLE_CREATE, Role.class);
|
||||||
|
entityEventDetails.put(EVENT_ROLE_UPDATE, Role.class);
|
||||||
|
entityEventDetails.put(EVENT_ROLE_DELETE, Role.class);
|
||||||
|
entityEventDetails.put(EVENT_ROLE_PERMISSION_CREATE, RolePermission.class);
|
||||||
|
entityEventDetails.put(EVENT_ROLE_PERMISSION_UPDATE, RolePermission.class);
|
||||||
|
entityEventDetails.put(EVENT_ROLE_PERMISSION_DELETE, RolePermission.class);
|
||||||
|
|
||||||
// Account events
|
// Account events
|
||||||
entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class);
|
entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class);
|
||||||
entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class);
|
entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class);
|
||||||
|
|||||||
@ -46,6 +46,8 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
|||||||
|
|
||||||
public short getType();
|
public short getType();
|
||||||
|
|
||||||
|
public Long getRoleId();
|
||||||
|
|
||||||
public State getState();
|
public State getState();
|
||||||
|
|
||||||
public Date getRemoved();
|
public Date getRemoved();
|
||||||
|
|||||||
@ -57,9 +57,9 @@ public interface AccountService {
|
|||||||
* @return the user if created successfully, null otherwise
|
* @return the user if created successfully, null otherwise
|
||||||
*/
|
*/
|
||||||
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
|
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
|
||||||
short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
|
short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
|
||||||
|
|
||||||
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId, Long domainId, String networkDomain,
|
||||||
Map<String, String> details, String accountUUID, String userUUID, User.Source source);
|
Map<String, String> details, String accountUUID, String userUUID, User.Source source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
27
api/src/org/apache/cloudstack/acl/Role.java
Normal file
27
api/src/org/apache/cloudstack/acl/Role.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.Identity;
|
||||||
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
|
|
||||||
|
public interface Role extends InternalIdentity, Identity {
|
||||||
|
String getName();
|
||||||
|
RoleType getRoleType();
|
||||||
|
String getDescription();
|
||||||
|
}
|
||||||
31
api/src/org/apache/cloudstack/acl/RolePermission.java
Normal file
31
api/src/org/apache/cloudstack/acl/RolePermission.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.Identity;
|
||||||
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
|
|
||||||
|
public interface RolePermission extends InternalIdentity, Identity {
|
||||||
|
enum Permission {ALLOW, DENY}
|
||||||
|
|
||||||
|
long getRoleId();
|
||||||
|
Rule getRule();
|
||||||
|
Permission getPermission();
|
||||||
|
String getDescription();
|
||||||
|
long getSortOrder();
|
||||||
|
}
|
||||||
52
api/src/org/apache/cloudstack/acl/RoleService.java
Normal file
52
api/src/org/apache/cloudstack/acl/RoleService.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RoleService {
|
||||||
|
|
||||||
|
ConfigKey<Boolean> EnableDynamicApiChecker = new ConfigKey<>("Advanced", Boolean.class, "dynamic.apichecker.enabled", "false",
|
||||||
|
"If set to true, this enables the dynamic role-based api access checker and disables the default static role-based api access checker.",
|
||||||
|
true);
|
||||||
|
|
||||||
|
boolean isEnabled();
|
||||||
|
Role findRole(final Long id);
|
||||||
|
Role createRole(final String name, final RoleType roleType, final String description);
|
||||||
|
boolean updateRole(final Role role, final String name, final RoleType roleType, final String description);
|
||||||
|
boolean deleteRole(final Role role);
|
||||||
|
|
||||||
|
RolePermission findRolePermission(final Long id);
|
||||||
|
RolePermission findRolePermissionByUuid(final String uuid);
|
||||||
|
|
||||||
|
RolePermission createRolePermission(final Role role, final Rule rule, final RolePermission.Permission permission, final String description);
|
||||||
|
/**
|
||||||
|
* updateRolePermission updates the order/position of an role permission
|
||||||
|
* @param role The role whose permissions needs to be re-ordered
|
||||||
|
* @param newOrder The new list of ordered role permissions
|
||||||
|
*/
|
||||||
|
boolean updateRolePermission(final Role role, final List<RolePermission> newOrder);
|
||||||
|
boolean deleteRolePermission(final RolePermission rolePermission);
|
||||||
|
|
||||||
|
List<Role> listRoles();
|
||||||
|
List<Role> findRolesByName(final String name);
|
||||||
|
List<Role> findRolesByType(final RoleType roleType);
|
||||||
|
List<RolePermission> findAllPermissionsBy(final Long roleId);
|
||||||
|
}
|
||||||
@ -16,18 +16,90 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.acl;
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.google.common.base.Enums;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
// Enum for default roles in CloudStack
|
// Enum for default roles in CloudStack
|
||||||
public enum RoleType {
|
public enum RoleType {
|
||||||
Admin(1), ResourceAdmin(2), DomainAdmin(4), User(8), Unknown(0);
|
Admin(1L, Account.ACCOUNT_TYPE_ADMIN, 1),
|
||||||
|
ResourceAdmin(2L, Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN, 2),
|
||||||
|
DomainAdmin(3L, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, 4),
|
||||||
|
User(4L, Account.ACCOUNT_TYPE_NORMAL, 8),
|
||||||
|
Unknown(-1L, (short) -1, 0);
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private short accountType;
|
||||||
private int mask;
|
private int mask;
|
||||||
|
|
||||||
private RoleType(int mask) {
|
RoleType(final long id, final short accountType, final int mask) {
|
||||||
|
this.id = id;
|
||||||
|
this.accountType = accountType;
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public long getId() {
|
||||||
return mask;
|
return id;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public short getAccountType() {
|
||||||
|
return accountType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMask() {
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RoleType fromString(final String name) {
|
||||||
|
if (!Strings.isNullOrEmpty(name)
|
||||||
|
&& Enums.getIfPresent(RoleType.class, name).isPresent()) {
|
||||||
|
return RoleType.valueOf(name);
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("Illegal RoleType name provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RoleType fromMask(int mask) {
|
||||||
|
for (RoleType roleType : RoleType.values()) {
|
||||||
|
if (roleType.getMask() == mask) {
|
||||||
|
return roleType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RoleType getByAccountType(final short accountType) {
|
||||||
|
RoleType roleType = RoleType.Unknown;
|
||||||
|
switch (accountType) {
|
||||||
|
case Account.ACCOUNT_TYPE_ADMIN:
|
||||||
|
roleType = RoleType.Admin;
|
||||||
|
break;
|
||||||
|
case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
|
||||||
|
roleType = RoleType.DomainAdmin;
|
||||||
|
break;
|
||||||
|
case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
|
||||||
|
roleType = RoleType.ResourceAdmin;
|
||||||
|
break;
|
||||||
|
case Account.ACCOUNT_TYPE_NORMAL:
|
||||||
|
roleType = RoleType.User;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return roleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long getRoleByAccountType(final Long roleId, final Short accountType) {
|
||||||
|
if (roleId == null && accountType != null) {
|
||||||
|
RoleType defaultRoleType = RoleType.getByAccountType(accountType);
|
||||||
|
if (defaultRoleType != null && defaultRoleType != RoleType.Unknown) {
|
||||||
|
return defaultRoleType.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Short getAccountTypeByRole(final Role role, final Short accountType) {
|
||||||
|
if (role != null && role.getId() > 0L) {
|
||||||
|
return role.getRoleType().getAccountType();
|
||||||
|
}
|
||||||
|
return accountType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
54
api/src/org/apache/cloudstack/acl/Rule.java
Normal file
54
api/src/org/apache/cloudstack/acl/Rule.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public final class Rule {
|
||||||
|
private final String rule;
|
||||||
|
private final static Pattern ALLOWED_PATTERN = Pattern.compile("^[a-zA-Z0-9*]+$");
|
||||||
|
|
||||||
|
public Rule(final String rule) {
|
||||||
|
validate(rule);
|
||||||
|
this.rule = rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(final String commandName) {
|
||||||
|
return !Strings.isNullOrEmpty(commandName)
|
||||||
|
&& commandName.toLowerCase().matches(rule.toLowerCase().replace("*", "\\w*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuleString() {
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean validate(final String rule) {
|
||||||
|
if (Strings.isNullOrEmpty(rule) || !ALLOWED_PATTERN.matcher(rule).matches()) {
|
||||||
|
throw new InvalidParameterValueException("Only API names and wildcards are allowed, invalid rule provided: " + rule);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -193,6 +193,7 @@ public class ApiConstants {
|
|||||||
public static final String PORTABLE_IP_ADDRESS = "portableipaddress";
|
public static final String PORTABLE_IP_ADDRESS = "portableipaddress";
|
||||||
public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
|
public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
|
||||||
public static final String POST_URL = "postURL";
|
public static final String POST_URL = "postURL";
|
||||||
|
public static final String PARENT = "parent";
|
||||||
public static final String PRIVATE_INTERFACE = "privateinterface";
|
public static final String PRIVATE_INTERFACE = "privateinterface";
|
||||||
public static final String PRIVATE_IP = "privateip";
|
public static final String PRIVATE_IP = "privateip";
|
||||||
public static final String PRIVATE_PORT = "privateport";
|
public static final String PRIVATE_PORT = "privateport";
|
||||||
@ -358,6 +359,12 @@ public class ApiConstants {
|
|||||||
public static final String PROJECT_IDS = "projectids";
|
public static final String PROJECT_IDS = "projectids";
|
||||||
public static final String PROJECT = "project";
|
public static final String PROJECT = "project";
|
||||||
public static final String ROLE = "role";
|
public static final String ROLE = "role";
|
||||||
|
public static final String ROLE_ID = "roleid";
|
||||||
|
public static final String ROLE_TYPE = "roletype";
|
||||||
|
public static final String ROLE_NAME = "rolename";
|
||||||
|
public static final String PERMISSION = "permission";
|
||||||
|
public static final String RULE = "rule";
|
||||||
|
public static final String RULE_ORDER = "ruleorder";
|
||||||
public static final String USER = "user";
|
public static final String USER = "user";
|
||||||
public static final String ACTIVE_ONLY = "activeonly";
|
public static final String ACTIVE_ONLY = "activeonly";
|
||||||
public static final String TOKEN = "token";
|
public static final String TOKEN = "token";
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import com.cloud.utils.HttpUtils;
|
import com.cloud.utils.HttpUtils;
|
||||||
|
import org.apache.cloudstack.acl.RoleService;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.RoleType;
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
@ -85,6 +86,7 @@ import com.cloud.vm.snapshot.VMSnapshotService;
|
|||||||
|
|
||||||
public abstract class BaseCmd {
|
public abstract class BaseCmd {
|
||||||
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
||||||
|
public static final String RESPONSE_SUFFIX = "response";
|
||||||
public static final String RESPONSE_TYPE_XML = HttpUtils.RESPONSE_TYPE_XML;
|
public static final String RESPONSE_TYPE_XML = HttpUtils.RESPONSE_TYPE_XML;
|
||||||
public static final String RESPONSE_TYPE_JSON = HttpUtils.RESPONSE_TYPE_JSON;
|
public static final String RESPONSE_TYPE_JSON = HttpUtils.RESPONSE_TYPE_JSON;
|
||||||
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
||||||
@ -104,12 +106,13 @@ public abstract class BaseCmd {
|
|||||||
@Parameter(name = "response", type = CommandType.STRING)
|
@Parameter(name = "response", type = CommandType.STRING)
|
||||||
private String responseType;
|
private String responseType;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ConfigurationService _configService;
|
public ConfigurationService _configService;
|
||||||
@Inject
|
@Inject
|
||||||
public AccountService _accountService;
|
public AccountService _accountService;
|
||||||
@Inject
|
@Inject
|
||||||
|
public RoleService roleService;
|
||||||
|
@Inject
|
||||||
public UserVmService _userVmService;
|
public UserVmService _userVmService;
|
||||||
@Inject
|
@Inject
|
||||||
public ManagementService _mgr;
|
public ManagementService _mgr;
|
||||||
@ -323,7 +326,7 @@ public abstract class BaseCmd {
|
|||||||
if (allowedRoles.length > 0) {
|
if (allowedRoles.length > 0) {
|
||||||
roleIsAllowed = false;
|
roleIsAllowed = false;
|
||||||
for (final RoleType allowedRole : allowedRoles) {
|
for (final RoleType allowedRole : allowedRoles) {
|
||||||
if (allowedRole.getValue() == caller.getType()) {
|
if (allowedRole.getAccountType() == caller.getType()) {
|
||||||
roleIsAllowed = true;
|
roleIsAllowed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
@ -31,6 +32,7 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
|||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.response.AccountResponse;
|
import org.apache.cloudstack.api.response.AccountResponse;
|
||||||
import org.apache.cloudstack.api.response.DomainResponse;
|
import org.apache.cloudstack.api.response.DomainResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -55,10 +57,12 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_TYPE,
|
@Parameter(name = ApiConstants.ACCOUNT_TYPE,
|
||||||
type = CommandType.SHORT,
|
type = CommandType.SHORT,
|
||||||
required = true,
|
|
||||||
description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
||||||
private Short accountType;
|
private Short accountType;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
|
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
|
||||||
private Long domainId;
|
private Long domainId;
|
||||||
|
|
||||||
@ -106,7 +110,11 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Short getAccountType() {
|
public Short getAccountType() {
|
||||||
return accountType;
|
return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return RoleType.getRoleByAccountType(roleId, accountType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDomainId() {
|
public Long getDomainId() {
|
||||||
@ -178,7 +186,7 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
validateParams();
|
validateParams();
|
||||||
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
|
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
|
||||||
UserAccount userAccount =
|
UserAccount userAccount =
|
||||||
_accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
|
_accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getRoleId(),
|
||||||
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
|
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
|
||||||
if (userAccount != null) {
|
if (userAccount != null) {
|
||||||
AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
|
AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
|
||||||
@ -196,5 +204,8 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
if(StringUtils.isEmpty(getPassword())) {
|
if(StringUtils.isEmpty(getPassword())) {
|
||||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed");
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed");
|
||||||
}
|
}
|
||||||
|
if (getAccountType() == null && (getRoleId() == null || getRoleId() < 1L)) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Neither account type and role ID are not provided");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,105 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
@APICommand(name = CreateRoleCmd.APINAME, description = "Creates a role", responseObject = RoleResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class CreateRoleCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "createRole";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,
|
||||||
|
description = "creates a role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true,
|
||||||
|
description = "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User",
|
||||||
|
validations = {ApiArgValidator.NotNullOrEmpty})
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the role")
|
||||||
|
private String roleDescription;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType getRoleType() {
|
||||||
|
return RoleType.fromString(roleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleDescription() {
|
||||||
|
return roleDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupResponse(final Role role) {
|
||||||
|
final RoleResponse response = new RoleResponse();
|
||||||
|
response.setId(role.getUuid());
|
||||||
|
response.setRoleName(role.getName());
|
||||||
|
response.setRoleType(role.getRoleType());
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
response.setObjectName("role");
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
CallContext.current().setEventDetails("Role: " + getRoleName() + ", type:" + getRoleType() + ", description: " + getRoleDescription());
|
||||||
|
final Role role = roleService.createRole(getRoleName(), getRoleType(), getRoleDescription());
|
||||||
|
if (role == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role");
|
||||||
|
}
|
||||||
|
setupResponse(role);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.acl.Rule;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.RolePermissionResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
@APICommand(name = CreateRolePermissionCmd.APINAME, description = "Adds a API permission to a role", responseObject = RolePermissionResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class CreateRolePermissionCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "createRolePermission";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, required = true, entityType = RoleResponse.class,
|
||||||
|
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.RULE, type = CommandType.STRING, required = true, description = "The API name or wildcard rule such as list*",
|
||||||
|
validations = {ApiArgValidator.NotNullOrEmpty})
|
||||||
|
private String rule;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.PERMISSION, type = CommandType.STRING, required = true, description = "The rule permission, allow or deny. Default: deny.")
|
||||||
|
private String permission;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the role permission")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rule getRule() {
|
||||||
|
return new Rule(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolePermission.Permission getPermission() {
|
||||||
|
if (Strings.isNullOrEmpty(permission)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return RolePermission.Permission.valueOf(permission.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupResponse(final RolePermission rolePermission, final Role role) {
|
||||||
|
final RolePermissionResponse response = new RolePermissionResponse();
|
||||||
|
response.setId(rolePermission.getUuid());
|
||||||
|
response.setRoleId(role.getUuid());
|
||||||
|
response.setRule(rolePermission.getRule());
|
||||||
|
response.setRulePermission(rolePermission.getPermission());
|
||||||
|
response.setDescription(rolePermission.getDescription());
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
response.setObjectName("rolepermission");
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
final Role role = roleService.findRole(getRoleId());
|
||||||
|
if (role == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription());
|
||||||
|
final RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription());
|
||||||
|
if (rolePermission == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission");
|
||||||
|
}
|
||||||
|
setupResponse(rolePermission, role);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
@APICommand(name = DeleteRoleCmd.APINAME, description = "Deletes a role", responseObject = SuccessResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class DeleteRoleCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "deleteRole";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
|
||||||
|
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Role role = roleService.findRole(getRoleId());
|
||||||
|
if (role == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Role id: " + role.getId());
|
||||||
|
boolean result = roleService.deleteRole(role);
|
||||||
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
response.setSuccess(result);
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.RolePermissionResponse;
|
||||||
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
@APICommand(name = DeleteRolePermissionCmd.APINAME, description = "Deletes a role permission", responseObject = SuccessResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class DeleteRolePermissionCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "deleteRolePermission";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RolePermissionResponse.class,
|
||||||
|
description = "ID of the role permission", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long rolePermissionId;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRolePermissionId() {
|
||||||
|
return rolePermissionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
RolePermission rolePermission = roleService.findRolePermission(getRolePermissionId());
|
||||||
|
if (rolePermission == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Role permission id: " + rolePermission.getId());
|
||||||
|
boolean result = roleService.deleteRolePermission(rolePermission);
|
||||||
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
response.setSuccess(result);
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.ListResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RolePermissionResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@APICommand(name = ListRolePermissionsCmd.APINAME, description = "Lists role permissions", responseObject = RolePermissionResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class ListRolePermissionsCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "listRolePermissions";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class,
|
||||||
|
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupResponse(final List<RolePermission> rolePermissions, final Long roleId) {
|
||||||
|
final Role roleProvided = roleService.findRole(roleId);
|
||||||
|
final ListResponse<RolePermissionResponse> response = new ListResponse<>();
|
||||||
|
final List<RolePermissionResponse> rolePermissionResponses = new ArrayList<>();
|
||||||
|
for (final RolePermission rolePermission : rolePermissions) {
|
||||||
|
final RolePermissionResponse rolePermissionResponse = new RolePermissionResponse();
|
||||||
|
Role role = roleProvided;
|
||||||
|
if (role == null) {
|
||||||
|
role = roleService.findRole(rolePermission.getRoleId());
|
||||||
|
}
|
||||||
|
rolePermissionResponse.setRoleId(role.getUuid());
|
||||||
|
rolePermissionResponse.setRoleName(role.getName());
|
||||||
|
rolePermissionResponse.setId(rolePermission.getUuid());
|
||||||
|
rolePermissionResponse.setRule(rolePermission.getRule());
|
||||||
|
rolePermissionResponse.setRulePermission(rolePermission.getPermission());
|
||||||
|
rolePermissionResponse.setDescription(rolePermission.getDescription());
|
||||||
|
rolePermissionResponse.setObjectName("rolepermission");
|
||||||
|
rolePermissionResponses.add(rolePermissionResponse);
|
||||||
|
}
|
||||||
|
response.setResponses(rolePermissionResponses);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
|
||||||
|
final List<RolePermission> rolePermissions = roleService.findAllPermissionsBy(getRoleId());
|
||||||
|
setupResponse(rolePermissions, getRoleId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
|
import com.cloud.exception.NetworkRuleConflictException;
|
||||||
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.ListResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@APICommand(name = ListRolesCmd.APINAME, description = "Lists dynamic roles in CloudStack", responseObject = RoleResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin})
|
||||||
|
public class ListRolesCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "listRoles";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "List role by role ID.")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List role by role name.")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "List role by role type, valid options are: Admin, ResourceAdmin, DomainAdmin, User.")
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType getRoleType() {
|
||||||
|
if (!Strings.isNullOrEmpty(roleType)) {
|
||||||
|
return RoleType.valueOf(roleType);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupResponse(final List<Role> roles) {
|
||||||
|
final ListResponse<RoleResponse> response = new ListResponse<>();
|
||||||
|
final List<RoleResponse> roleResponses = new ArrayList<>();
|
||||||
|
for (final Role role : roles) {
|
||||||
|
if (role == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final RoleResponse roleResponse = new RoleResponse();
|
||||||
|
roleResponse.setId(role.getUuid());
|
||||||
|
roleResponse.setRoleName(role.getName());
|
||||||
|
roleResponse.setRoleType(role.getRoleType());
|
||||||
|
roleResponse.setDescription(role.getDescription());
|
||||||
|
roleResponse.setObjectName("role");
|
||||||
|
roleResponses.add(roleResponse);
|
||||||
|
}
|
||||||
|
response.setResponses(roleResponses);
|
||||||
|
response.setResponseName(getCommandName());
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||||
|
final List<Role> roles;
|
||||||
|
if (getId() != null && getId() > 0L) {
|
||||||
|
roles = Collections.singletonList(roleService.findRole(getId()));
|
||||||
|
} else if (!Strings.isNullOrEmpty(getName())) {
|
||||||
|
roles = roleService.findRolesByName(getName());
|
||||||
|
} else if (getRoleType() != null){
|
||||||
|
roles = roleService.findRolesByType(getRoleType());
|
||||||
|
} else {
|
||||||
|
roles = roleService.listRoles();
|
||||||
|
}
|
||||||
|
setupResponse(roles);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
@APICommand(name = UpdateRoleCmd.APINAME, description = "Updates a role", responseObject = SuccessResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class UpdateRoleCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "updateRole";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
|
||||||
|
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "creates a role with this unique name")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.TYPE, type = BaseCmd.CommandType.STRING, description = "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User")
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, description = "The description of the role")
|
||||||
|
private String roleDescription;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType getRoleType() {
|
||||||
|
if (!Strings.isNullOrEmpty(roleType)) {
|
||||||
|
return RoleType.fromString(roleType);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleDescription() {
|
||||||
|
return roleDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Role role = roleService.findRole(getRoleId());
|
||||||
|
if (role == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Role: " + getRoleName() + ", type:" + getRoleType() + ", description: " + getRoleDescription());
|
||||||
|
boolean result = roleService.updateRole(role, getRoleName(), getRoleType(), getRoleDescription());
|
||||||
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
response.setSuccess(result);
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.command.admin.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.ApiArgValidator;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
|
import org.apache.cloudstack.api.Parameter;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.response.RolePermissionResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@APICommand(name = UpdateRolePermissionCmd.APINAME, description = "Updates a role permission order", responseObject = SuccessResponse.class,
|
||||||
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||||
|
since = "4.9.0",
|
||||||
|
authorized = {RoleType.Admin})
|
||||||
|
public class UpdateRolePermissionCmd extends BaseCmd {
|
||||||
|
public static final String APINAME = "updateRolePermission";
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, required = true, entityType = RoleResponse.class,
|
||||||
|
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, required = true, entityType = RolePermissionResponse.class,
|
||||||
|
description = "The parent role permission uuid, use 0 to move this rule at the top of the list")
|
||||||
|
private List<Long> rulePermissionOrder;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getRulePermissionOrder() {
|
||||||
|
return rulePermissionOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEntityOwnerId() {
|
||||||
|
return Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
final Role role = roleService.findRole(getRoleId());
|
||||||
|
if (role == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Reordering permissions for role id: " + role.getId());
|
||||||
|
final List<RolePermission> rolePermissionsOrder = new ArrayList<>();
|
||||||
|
for (Long rolePermissionId : getRulePermissionOrder()) {
|
||||||
|
final RolePermission rolePermission = roleService.findRolePermission(rolePermissionId);
|
||||||
|
if (rolePermission == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Provided role permission(s) do not exist");
|
||||||
|
}
|
||||||
|
rolePermissionsOrder.add(rolePermission);
|
||||||
|
}
|
||||||
|
boolean result = roleService.updateRolePermission(role, rolePermissionsOrder);
|
||||||
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
response.setSuccess(result);
|
||||||
|
setResponseObject(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,6 +16,8 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api.command.admin.config;
|
package org.apache.cloudstack.api.command.admin.config;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.acl.RoleService;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -81,6 +83,10 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||||||
return cfgName;
|
return cfgName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCfgName(final String cfgName) {
|
||||||
|
this.cfgName = cfgName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -117,6 +123,12 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
if (Strings.isNullOrEmpty(getCfgName())) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty configuration name provided");
|
||||||
|
}
|
||||||
|
if (getCfgName().equalsIgnoreCase(RoleService.EnableDynamicApiChecker.key())) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Restricted configuration update not allowed");
|
||||||
|
}
|
||||||
Configuration cfg = _configService.updateConfiguration(this);
|
Configuration cfg = _configService.updateConfiguration(this);
|
||||||
if (cfg != null) {
|
if (cfg != null) {
|
||||||
ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
|
ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
|
||||||
|
|||||||
@ -47,6 +47,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
|
|||||||
Map<String, Object> capabilities = _mgr.listCapabilities(this);
|
Map<String, Object> capabilities = _mgr.listCapabilities(this);
|
||||||
CapabilitiesResponse response = new CapabilitiesResponse();
|
CapabilitiesResponse response = new CapabilitiesResponse();
|
||||||
response.setSecurityGroupsEnabled((Boolean)capabilities.get("securityGroupsEnabled"));
|
response.setSecurityGroupsEnabled((Boolean)capabilities.get("securityGroupsEnabled"));
|
||||||
|
response.setDynamicRolesEnabled(roleService.isEnabled());
|
||||||
response.setCloudStackVersion((String)capabilities.get("cloudStackVersion"));
|
response.setCloudStackVersion((String)capabilities.get("cloudStackVersion"));
|
||||||
response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
|
response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
|
||||||
response.setSupportELB((String)capabilities.get("supportELB"));
|
response.setSupportELB((String)capabilities.get("supportELB"));
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.BaseResponse;
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
import org.apache.cloudstack.api.EntityReference;
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
@ -43,6 +44,18 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
|
|||||||
@Param(description = "account type (admin, domain-admin, user)")
|
@Param(description = "account type (admin, domain-admin, user)")
|
||||||
private Short accountType;
|
private Short accountType;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_ID)
|
||||||
|
@Param(description = "the ID of the role")
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_TYPE)
|
||||||
|
@Param(description = "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)")
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_NAME)
|
||||||
|
@Param(description = "the name of the role")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||||
@Param(description = "id of the Domain the account belongs too")
|
@Param(description = "id of the Domain the account belongs too")
|
||||||
private String domainId;
|
private String domainId;
|
||||||
@ -260,6 +273,20 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
|
|||||||
this.accountType = accountType;
|
this.accountType = accountType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleType(RoleType roleType) {
|
||||||
|
if (roleType != null) {
|
||||||
|
this.roleType = roleType.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDomainId(String domainId) {
|
public void setDomainId(String domainId) {
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||||||
@Param(description = "true if security groups support is enabled, false otherwise")
|
@Param(description = "true if security groups support is enabled, false otherwise")
|
||||||
private boolean securityGroupsEnabled;
|
private boolean securityGroupsEnabled;
|
||||||
|
|
||||||
|
@SerializedName("dynamicrolesenabled")
|
||||||
|
@Param(description = "true if dynamic role-based api checker is enabled, false otherwise")
|
||||||
|
private boolean dynamicRolesEnabled;
|
||||||
|
|
||||||
@SerializedName("cloudstackversion")
|
@SerializedName("cloudstackversion")
|
||||||
@Param(description = "version of the cloud stack")
|
@Param(description = "version of the cloud stack")
|
||||||
private String cloudStackVersion;
|
private String cloudStackVersion;
|
||||||
@ -84,6 +88,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||||||
this.securityGroupsEnabled = securityGroupsEnabled;
|
this.securityGroupsEnabled = securityGroupsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDynamicRolesEnabled(boolean dynamicRolesEnabled) {
|
||||||
|
this.dynamicRolesEnabled = dynamicRolesEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCloudStackVersion(String cloudStackVersion) {
|
public void setCloudStackVersion(String cloudStackVersion) {
|
||||||
this.cloudStackVersion = cloudStackVersion;
|
this.cloudStackVersion = cloudStackVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,101 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.response;
|
||||||
|
|
||||||
|
import com.cloud.serializer.Param;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.Rule;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
|
|
||||||
|
@EntityReference(value = RolePermission.class)
|
||||||
|
public class RolePermissionResponse extends BaseResponse {
|
||||||
|
@SerializedName(ApiConstants.ID)
|
||||||
|
@Param(description = "the ID of the role permission")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_ID)
|
||||||
|
@Param(description = "the ID of the role to which the role permission belongs")
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_NAME)
|
||||||
|
@Param(description = "the name of the role to which the role permission belongs")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.RULE)
|
||||||
|
@Param(description = "the api name or wildcard rule")
|
||||||
|
private String rule;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.PERMISSION)
|
||||||
|
@Param(description = "the permission type of the api name or wildcard rule, allow/deny")
|
||||||
|
private String rulePermission;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.DESCRIPTION)
|
||||||
|
@Param(description = "the description of the role permission")
|
||||||
|
private String ruleDescription;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRule() {
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRule(Rule rule) {
|
||||||
|
if (rule != null) {
|
||||||
|
this.rule = rule.getRuleString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRulePermission() {
|
||||||
|
return rulePermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRulePermission(RolePermission.Permission rulePermission) {
|
||||||
|
if (rulePermission != null) {
|
||||||
|
this.rulePermission = rulePermission.name().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.ruleDescription = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
63
api/src/org/apache/cloudstack/api/response/RoleResponse.java
Normal file
63
api/src/org/apache/cloudstack/api/response/RoleResponse.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.api.response;
|
||||||
|
|
||||||
|
import com.cloud.serializer.Param;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
|
|
||||||
|
@EntityReference(value = Role.class)
|
||||||
|
public class RoleResponse extends BaseResponse {
|
||||||
|
@SerializedName(ApiConstants.ID)
|
||||||
|
@Param(description = "the ID of the role")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.NAME)
|
||||||
|
@Param(description = "the name of the role")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.TYPE)
|
||||||
|
@Param(description = "the type of the role")
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.DESCRIPTION)
|
||||||
|
@Param(description = "the description of the role")
|
||||||
|
private String roleDescription;
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleType(RoleType roleType) {
|
||||||
|
if (roleType != null) {
|
||||||
|
this.roleType = roleType.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.roleDescription = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,6 +20,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.BaseResponse;
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
import org.apache.cloudstack.api.EntityReference;
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
@ -65,6 +66,18 @@ public class UserResponse extends BaseResponse {
|
|||||||
@Param(description = "the account type of the user")
|
@Param(description = "the account type of the user")
|
||||||
private Short accountType;
|
private Short accountType;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_ID)
|
||||||
|
@Param(description = "the ID of the role")
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_TYPE)
|
||||||
|
@Param(description = "the type of the role")
|
||||||
|
private String roleType;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ROLE_NAME)
|
||||||
|
@Param(description = "the name of the role")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
@SerializedName("domainid")
|
@SerializedName("domainid")
|
||||||
@Param(description = "the domain ID of the user")
|
@Param(description = "the domain ID of the user")
|
||||||
private String domainId;
|
private String domainId;
|
||||||
@ -174,6 +187,20 @@ public class UserResponse extends BaseResponse {
|
|||||||
this.accountType = accountType;
|
this.accountType = accountType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleType(RoleType roleType) {
|
||||||
|
if (roleType != null) {
|
||||||
|
this.roleType = roleType.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDomainId() {
|
public String getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|||||||
100
api/test/org/apache/cloudstack/acl/RoleTypeTest.java
Normal file
100
api/test/org/apache/cloudstack/acl/RoleTypeTest.java
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class RoleTypeTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidRoleTypeFromString() {
|
||||||
|
for (RoleType roleType : RoleType.values()) {
|
||||||
|
Assert.assertEquals(RoleType.fromString(roleType.name()), roleType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvalidRoleTypeFromString() {
|
||||||
|
for (String roleType : Arrays.asList(null, "", "admin", "12345%&^*")) {
|
||||||
|
try {
|
||||||
|
RoleType.fromString(roleType);
|
||||||
|
Assert.fail("Invalid roletype provided, exception was expected");
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
Assert.assertEquals(e.getMessage(), "Illegal RoleType name provided");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDefaultRoleMaskByValue() {
|
||||||
|
Assert.assertEquals(RoleType.fromMask(1), RoleType.Admin);
|
||||||
|
Assert.assertEquals(RoleType.fromMask(2), RoleType.ResourceAdmin);
|
||||||
|
Assert.assertEquals(RoleType.fromMask(4), RoleType.DomainAdmin);
|
||||||
|
Assert.assertEquals(RoleType.fromMask(8), RoleType.User);
|
||||||
|
Assert.assertEquals(RoleType.fromMask(0), RoleType.Unknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetByAccountType() {
|
||||||
|
Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_NORMAL), RoleType.User);
|
||||||
|
Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_ADMIN), RoleType.Admin);
|
||||||
|
Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_DOMAIN_ADMIN), RoleType.DomainAdmin);
|
||||||
|
Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN), RoleType.ResourceAdmin);
|
||||||
|
Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_PROJECT), RoleType.Unknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetRoleByAccountTypeWhenRoleIdIsProvided() {
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(123L, Account.ACCOUNT_TYPE_ADMIN), Long.valueOf(123L));
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(1234L, null), Long.valueOf(1234L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetRoleByAccountTypeForDefaultAccountTypes() {
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_ADMIN), (Long) RoleType.Admin.getId());
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_NORMAL), (Long) RoleType.User.getId());
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_DOMAIN_ADMIN), (Long) RoleType.DomainAdmin.getId());
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN), (Long) RoleType.ResourceAdmin.getId());
|
||||||
|
Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_PROJECT), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAccountTypeByRoleWhenRoleIsNull() {
|
||||||
|
for (Short accountType: Arrays.asList(
|
||||||
|
Account.ACCOUNT_TYPE_NORMAL,
|
||||||
|
Account.ACCOUNT_TYPE_ADMIN,
|
||||||
|
Account.ACCOUNT_TYPE_DOMAIN_ADMIN,
|
||||||
|
Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN,
|
||||||
|
Account.ACCOUNT_TYPE_PROJECT,
|
||||||
|
(short) 12345)) {
|
||||||
|
Assert.assertEquals(RoleType.getAccountTypeByRole(null, accountType), accountType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAccountTypeByRole() {
|
||||||
|
Role role = Mockito.mock(Role.class);
|
||||||
|
Mockito.when(role.getRoleType()).thenReturn(RoleType.Admin);
|
||||||
|
Mockito.when(role.getId()).thenReturn(100L);
|
||||||
|
Assert.assertEquals(RoleType.getAccountTypeByRole(role, null), (Short) RoleType.Admin.getAccountType());
|
||||||
|
}
|
||||||
|
}
|
||||||
98
api/test/org/apache/cloudstack/acl/RuleTest.java
Normal file
98
api/test/org/apache/cloudstack/acl/RuleTest.java
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class RuleTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString() throws Exception {
|
||||||
|
Rule rule = new Rule("someString");
|
||||||
|
Assert.assertEquals(rule.toString(), "someString");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesEmpty() throws Exception {
|
||||||
|
Rule rule = new Rule("someString");
|
||||||
|
Assert.assertFalse(rule.matches(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesNull() throws Exception {
|
||||||
|
Rule rule = new Rule("someString");
|
||||||
|
Assert.assertFalse(rule.matches(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesSpace() throws Exception {
|
||||||
|
Rule rule = new Rule("someString");
|
||||||
|
Assert.assertFalse(rule.matches(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesAPI() throws Exception {
|
||||||
|
Rule rule = new Rule("someApi");
|
||||||
|
Assert.assertTrue(rule.matches("someApi"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesWildcardSuffix() throws Exception {
|
||||||
|
Rule rule = new Rule("list*");
|
||||||
|
Assert.assertTrue(rule.matches("listHosts"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesWildcardPrefix() throws Exception {
|
||||||
|
Rule rule = new Rule("*User");
|
||||||
|
Assert.assertTrue(rule.matches("createUser"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMatchesWildcardMiddle() throws Exception {
|
||||||
|
Rule rule = new Rule("list*s");
|
||||||
|
Assert.assertTrue(rule.matches("listClusters"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidateRuleWithValidData() throws Exception {
|
||||||
|
for (String rule : Arrays.asList("a", "1", "someApi", "someApi321", "123SomeApi",
|
||||||
|
"prefix*", "*middle*", "*Suffix",
|
||||||
|
"*", "**", "f***", "m0nk3yMa**g1c*")) {
|
||||||
|
Assert.assertEquals(new Rule(rule).toString(), rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidateRuleWithInvalidData() throws Exception {
|
||||||
|
for (String rule : Arrays.asList(null, "", " ", " ", "\n", "\t", "\r", "\"", "\'",
|
||||||
|
"^someApi$", "^someApi", "some$", "some-Api;", "some,Api",
|
||||||
|
"^", "$", "^$", ".*", "\\w+", "r**l3rd0@Kr3", "j@s1n|+|0ȷ",
|
||||||
|
"[a-z0-9-]+", "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$")) {
|
||||||
|
try {
|
||||||
|
new Rule(rule);
|
||||||
|
Assert.fail("Invalid rule, exception was expected");
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
Assert.assertTrue(e.getMessage().startsWith("Only API names and wildcards are allowed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.api.command.admin.account;
|
package org.apache.cloudstack.api.command.admin.account;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleService;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
@ -41,10 +42,13 @@ public class CreateAccountCmdTest {
|
|||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
|
@Mock
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private CreateAccountCmd createAccountCmd = new CreateAccountCmd();
|
private CreateAccountCmd createAccountCmd = new CreateAccountCmd();
|
||||||
|
|
||||||
|
private long roleId = 1L;
|
||||||
private short accountType = 1;
|
private short accountType = 1;
|
||||||
private Long domainId = 1L;
|
private Long domainId = 1L;
|
||||||
|
|
||||||
@ -69,7 +73,7 @@ public class CreateAccountCmdTest {
|
|||||||
} catch (ServerApiException e) {
|
} catch (ServerApiException e) {
|
||||||
Assert.assertTrue("Received exception as the mock accountService createUserAccount returns null user", true);
|
Assert.assertTrue("Received exception as the mock accountService createUserAccount returns null user", true);
|
||||||
}
|
}
|
||||||
Mockito.verify(accountService, Mockito.times(1)).createUserAccount(null, "Test", null, null, null, null, null, accountType, domainId, null, null, null, null);
|
Mockito.verify(accountService, Mockito.times(1)).createUserAccount(null, "Test", null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -82,7 +86,7 @@ public class CreateAccountCmdTest {
|
|||||||
Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
|
Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
|
||||||
Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
|
Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
|
||||||
}
|
}
|
||||||
Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, domainId, null, null, null, null);
|
Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -95,6 +99,6 @@ public class CreateAccountCmdTest {
|
|||||||
Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
|
Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
|
||||||
Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
|
Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
|
||||||
}
|
}
|
||||||
Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, domainId, null, null, null, null);
|
Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.test;
|
|||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleService;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -48,22 +49,46 @@ public class UpdateCfgCmdTest extends TestCase {
|
|||||||
updateCfgCmd = new UpdateCfgCmd();
|
updateCfgCmd = new UpdateCfgCmd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExecuteForEmptyCfgName() {
|
||||||
|
updateCfgCmd._configService = configService;
|
||||||
|
|
||||||
|
try {
|
||||||
|
updateCfgCmd.execute();
|
||||||
|
} catch (ServerApiException exception) {
|
||||||
|
Assert.assertEquals("Empty configuration name provided", exception.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExecuteForRestrictedCfg() {
|
||||||
|
updateCfgCmd._configService = configService;
|
||||||
|
updateCfgCmd.setCfgName(RoleService.EnableDynamicApiChecker.key());
|
||||||
|
|
||||||
|
try {
|
||||||
|
updateCfgCmd.execute();
|
||||||
|
} catch (ServerApiException exception) {
|
||||||
|
Assert.assertEquals("Restricted configuration update not allowed", exception.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExecuteForEmptyResult() {
|
public void testExecuteForEmptyResult() {
|
||||||
updateCfgCmd._configService = configService;
|
updateCfgCmd._configService = configService;
|
||||||
|
updateCfgCmd.setCfgName("some.cfg");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
updateCfgCmd.execute();
|
updateCfgCmd.execute();
|
||||||
} catch (ServerApiException exception) {
|
} catch (ServerApiException exception) {
|
||||||
Assert.assertEquals("Failed to update config", exception.getDescription());
|
Assert.assertEquals("Failed to update config", exception.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExecuteForNullResult() {
|
public void testExecuteForNullResult() {
|
||||||
|
|
||||||
updateCfgCmd._configService = configService;
|
updateCfgCmd._configService = configService;
|
||||||
|
updateCfgCmd.setCfgName("some.cfg");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(null);
|
Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(null);
|
||||||
@ -88,6 +113,7 @@ public class UpdateCfgCmdTest extends TestCase {
|
|||||||
Configuration cfg = Mockito.mock(Configuration.class);
|
Configuration cfg = Mockito.mock(Configuration.class);
|
||||||
updateCfgCmd._configService = configService;
|
updateCfgCmd._configService = configService;
|
||||||
updateCfgCmd._responseGenerator = responseGenerator;
|
updateCfgCmd._responseGenerator = responseGenerator;
|
||||||
|
updateCfgCmd.setCfgName("some.cfg");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(cfg);
|
Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(cfg);
|
||||||
|
|||||||
@ -1095,9 +1095,17 @@ label.retry.interval=Retry Interval
|
|||||||
label.review=Review
|
label.review=Review
|
||||||
label.revoke.project.invite=Revoke invitation
|
label.revoke.project.invite=Revoke invitation
|
||||||
label.role=Role
|
label.role=Role
|
||||||
|
label.roles=Roles
|
||||||
|
label.roletype=Role Type
|
||||||
|
label.add.role=Add Role
|
||||||
|
label.edit.role=Edit Role
|
||||||
|
label.delete.role=Delete Role
|
||||||
|
message.role.ordering.fail=Reordering of rule permissions aborted as the list has changed while you were making changes. Please try again.
|
||||||
label.root.certificate=Root certificate
|
label.root.certificate=Root certificate
|
||||||
label.root.disk.controller=Root disk controller
|
label.root.disk.controller=Root disk controller
|
||||||
label.root.disk.offering=Root Disk Offering
|
label.root.disk.offering=Root Disk Offering
|
||||||
|
label.permission=Permission
|
||||||
|
label.rule=Rule
|
||||||
label.rules=Rules
|
label.rules=Rules
|
||||||
label.running.vms=Running VMs
|
label.running.vms=Running VMs
|
||||||
label.s3.access_key=Access Key
|
label.s3.access_key=Access Key
|
||||||
|
|||||||
@ -50,6 +50,11 @@
|
|||||||
<artifactId>cloud-plugin-acl-static-role-based</artifactId>
|
<artifactId>cloud-plugin-acl-static-role-based</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
|
<artifactId>cloud-plugin-acl-dynamic-role-based</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.cloudstack</groupId>
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
<artifactId>cloud-plugin-dedicated-resources</artifactId>
|
<artifactId>cloud-plugin-dedicated-resources</artifactId>
|
||||||
|
|||||||
1
debian/cloudstack-management.install
vendored
1
debian/cloudstack-management.install
vendored
@ -18,7 +18,6 @@
|
|||||||
/etc/cloudstack/management/catalina.policy
|
/etc/cloudstack/management/catalina.policy
|
||||||
/etc/cloudstack/management/catalina.properties
|
/etc/cloudstack/management/catalina.properties
|
||||||
/etc/cloudstack/management/logging.properties
|
/etc/cloudstack/management/logging.properties
|
||||||
/etc/cloudstack/management/commands.properties
|
|
||||||
/etc/cloudstack/management/ehcache.xml
|
/etc/cloudstack/management/ehcache.xml
|
||||||
/etc/cloudstack/management/server-ssl.xml
|
/etc/cloudstack/management/server-ssl.xml
|
||||||
/etc/cloudstack/management/server-nonssl.xml
|
/etc/cloudstack/management/server-nonssl.xml
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@ -15,7 +15,7 @@ Description: A common package which contains files which are shared by several C
|
|||||||
|
|
||||||
Package: cloudstack-management
|
Package: cloudstack-management
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6, sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
|
Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6 | tomcat7, sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
|
||||||
Conflicts: cloud-server, cloud-client, cloud-client-ui
|
Conflicts: cloud-server, cloud-client, cloud-client-ui
|
||||||
Description: CloudStack server library
|
Description: CloudStack server library
|
||||||
The CloudStack management server
|
The CloudStack management server
|
||||||
|
|||||||
@ -106,6 +106,11 @@ INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
|||||||
VALUES ('Advanced', 'DEFAULT', 'management-server',
|
VALUES ('Advanced', 'DEFAULT', 'management-server',
|
||||||
'direct.agent.load.size', '1000');
|
'direct.agent.load.size', '1000');
|
||||||
|
|
||||||
|
-- Enable dynamic RBAC by default for fresh deployments
|
||||||
|
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
||||||
|
VALUES ('Advanced', 'DEFAULT', 'RoleService',
|
||||||
|
'dynamic.apichecker.enabled', 'true');
|
||||||
|
|
||||||
-- Add developer configuration entry; allows management server to be run as a user other than "cloud"
|
-- Add developer configuration entry; allows management server to be run as a user other than "cloud"
|
||||||
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
||||||
VALUES ('Advanced', 'DEFAULT', 'management-server',
|
VALUES ('Advanced', 'DEFAULT', 'management-server',
|
||||||
|
|||||||
@ -113,6 +113,8 @@
|
|||||||
<!--
|
<!--
|
||||||
DAOs with default configuration
|
DAOs with default configuration
|
||||||
-->
|
-->
|
||||||
|
<bean id="roleDaoImpl" class="org.apache.cloudstack.acl.dao.RoleDaoImpl" />
|
||||||
|
<bean id="rolePermissionsDaoImpl" class="org.apache.cloudstack.acl.dao.RolePermissionsDaoImpl" />
|
||||||
<bean id="accountDaoImpl" class="com.cloud.user.dao.AccountDaoImpl" />
|
<bean id="accountDaoImpl" class="com.cloud.user.dao.AccountDaoImpl" />
|
||||||
<bean id="accountDetailsDaoImpl" class="com.cloud.user.AccountDetailsDaoImpl" />
|
<bean id="accountDetailsDaoImpl" class="com.cloud.user.AccountDetailsDaoImpl" />
|
||||||
<bean id="accountJoinDaoImpl" class="com.cloud.api.query.dao.AccountJoinDaoImpl" />
|
<bean id="accountJoinDaoImpl" class="com.cloud.api.query.dao.AccountJoinDaoImpl" />
|
||||||
|
|||||||
@ -17,12 +17,21 @@
|
|||||||
|
|
||||||
package com.cloud.upgrade.dao;
|
package com.cloud.upgrade.dao;
|
||||||
|
|
||||||
|
import com.cloud.utils.PropertiesUtil;
|
||||||
|
import com.cloud.utils.db.ScriptRunner;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.utils.script.Script;
|
import com.cloud.utils.script.Script;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Upgrade481to490 implements DbUpgrade {
|
public class Upgrade481to490 implements DbUpgrade {
|
||||||
final static Logger s_logger = Logger.getLogger(Upgrade481to490.class);
|
final static Logger s_logger = Logger.getLogger(Upgrade481to490.class);
|
||||||
@ -53,6 +62,71 @@ public class Upgrade481to490 implements DbUpgrade {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performDataMigration(Connection conn) {
|
public void performDataMigration(Connection conn) {
|
||||||
|
setupRolesAndPermissionsForDynamicChecker(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void migrateAccountsToDefaultRoles(final Connection conn) {
|
||||||
|
try (final PreparedStatement selectStatement = conn.prepareStatement("SELECT `id`, `type` FROM `cloud`.`account`;");
|
||||||
|
final ResultSet selectResultSet = selectStatement.executeQuery()) {
|
||||||
|
while (selectResultSet.next()) {
|
||||||
|
final Long accountId = selectResultSet.getLong(1);
|
||||||
|
final Short accountType = selectResultSet.getShort(2);
|
||||||
|
final Long roleId = RoleType.getByAccountType(accountType).getId();
|
||||||
|
if (roleId < 1L || roleId > 4L) {
|
||||||
|
s_logger.warn("Skipping role ID migration due to invalid role_id resolved for account id=" + accountId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`account` SET account.role_id = ? WHERE account.id = ? ;")) {
|
||||||
|
updateStatement.setLong(1, roleId);
|
||||||
|
updateStatement.setLong(2, accountId);
|
||||||
|
updateStatement.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
s_logger.error("Failed to update cloud.account role_id for account id:" + accountId + " with exception: " + e.getMessage());
|
||||||
|
throw new CloudRuntimeException("Exception while updating cloud.account role_id", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new CloudRuntimeException("Exception while migrating existing account table's role_id column to a role based on account type", e);
|
||||||
|
}
|
||||||
|
s_logger.debug("Done migrating existing accounts to use one of default roles based on account type");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupRolesAndPermissionsForDynamicChecker(final Connection conn) {
|
||||||
|
final String alterTableSql = "ALTER TABLE `cloud`.`account` " +
|
||||||
|
"ADD COLUMN `role_id` bigint(20) unsigned COMMENT 'role id for this account' AFTER `type`, " +
|
||||||
|
"ADD KEY `fk_account__role_id` (`role_id`), " +
|
||||||
|
"ADD CONSTRAINT `fk_account__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);";
|
||||||
|
try (final PreparedStatement pstmt = conn.prepareStatement(alterTableSql)) {
|
||||||
|
pstmt.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
if (e.getMessage().contains("role_id")) {
|
||||||
|
s_logger.warn("cloud.account table already has the role_id column, skipping altering table and migration of accounts");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw new CloudRuntimeException("Unable to create column quota_calculated in table cloud_usage.cloud_usage", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
migrateAccountsToDefaultRoles(conn);
|
||||||
|
|
||||||
|
final Map<String, String> apiMap = PropertiesUtil.processConfigFile(new String[] { PropertiesUtil.getDefaultApiCommandsFileName() });
|
||||||
|
if (apiMap == null || apiMap.isEmpty()) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("The commands.properties file and default role permissions were not found. " +
|
||||||
|
"Assuming new installation, configuring default role-api mappings.");
|
||||||
|
}
|
||||||
|
String script = Script.findScript("", "db/create-default-role-api-mappings.sql");
|
||||||
|
if (script == null) {
|
||||||
|
s_logger.error("Unable to find default role-api mapping sql file, please configure api per role manually");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try(final FileReader reader = new FileReader(new File(script))) {
|
||||||
|
ScriptRunner runner = new ScriptRunner(conn, false, true);
|
||||||
|
runner.runScript(reader);
|
||||||
|
} catch (SQLException | IOException e) {
|
||||||
|
s_logger.error("Unable to insert default api-role mappings from file: " + script + ". Please configure api per role manually, giving up!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +135,6 @@ public class Upgrade481to490 implements DbUpgrade {
|
|||||||
if (script == null) {
|
if (script == null) {
|
||||||
throw new CloudRuntimeException("Unable to find db/schema-481to490-cleanup.sql");
|
throw new CloudRuntimeException("Unable to find db/schema-481to490-cleanup.sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File[] {new File(script)};
|
return new File[] {new File(script)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.user;
|
package com.cloud.user;
|
||||||
|
|
||||||
import java.util.Date;
|
import com.cloud.utils.db.GenericDao;
|
||||||
import java.util.UUID;
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@ -27,8 +27,8 @@ import javax.persistence.GeneratedValue;
|
|||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import java.util.Date;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "account")
|
@Table(name = "account")
|
||||||
@ -44,6 +44,9 @@ public class AccountVO implements Account {
|
|||||||
@Column(name = "type")
|
@Column(name = "type")
|
||||||
private short type = ACCOUNT_TYPE_NORMAL;
|
private short type = ACCOUNT_TYPE_NORMAL;
|
||||||
|
|
||||||
|
@Column(name = "role_id")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
@Column(name = "domain_id")
|
@Column(name = "domain_id")
|
||||||
private long domainId;
|
private long domainId;
|
||||||
|
|
||||||
@ -78,13 +81,21 @@ public class AccountVO implements Account {
|
|||||||
uuid = UUID.randomUUID().toString();
|
uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid) {
|
public AccountVO(final String accountName, final long domainId, final String networkDomain, final short type, final String uuid) {
|
||||||
this.accountName = accountName;
|
this.accountName = accountName;
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
this.networkDomain = networkDomain;
|
this.networkDomain = networkDomain;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
state = State.enabled;
|
this.state = State.enabled;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
|
this.roleId = RoleType.getRoleByAccountType(null, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountVO(final String accountName, final long domainId, final String networkDomain, final short type, final Long roleId, final String uuid) {
|
||||||
|
this(accountName, domainId, networkDomain, type, uuid);
|
||||||
|
if (roleId != null) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNeedsCleanup(boolean value) {
|
public void setNeedsCleanup(boolean value) {
|
||||||
@ -122,6 +133,14 @@ public class AccountVO implements Account {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(long roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDomainId() {
|
public long getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
|
|||||||
@ -41,6 +41,8 @@ public interface AccountDao extends GenericDao<AccountVO, Long> {
|
|||||||
|
|
||||||
List<AccountVO> findActiveAccountsForDomain(Long domain);
|
List<AccountVO> findActiveAccountsForDomain(Long domain);
|
||||||
|
|
||||||
|
List<AccountVO> findAccountsByRole(Long roleId);
|
||||||
|
|
||||||
void markForCleanup(long accountId);
|
void markForCleanup(long accountId);
|
||||||
|
|
||||||
List<AccountVO> listAccounts(String accountName, Long domainId, Filter filter);
|
List<AccountVO> listAccounts(String accountName, Long domainId, Filter filter);
|
||||||
|
|||||||
@ -44,7 +44,7 @@ import com.cloud.utils.db.TransactionLegacy;
|
|||||||
public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements AccountDao {
|
public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements AccountDao {
|
||||||
private static final Logger s_logger = Logger.getLogger(AccountDaoImpl.class);
|
private static final Logger s_logger = Logger.getLogger(AccountDaoImpl.class);
|
||||||
private static final String FIND_USER_ACCOUNT_BY_API_KEY = "SELECT u.id, u.username, u.account_id, u.secret_key, u.state, "
|
private static final String FIND_USER_ACCOUNT_BY_API_KEY = "SELECT u.id, u.username, u.account_id, u.secret_key, u.state, "
|
||||||
+ "a.id, a.account_name, a.type, a.domain_id, a.state " + "FROM `cloud`.`user` u, `cloud`.`account` a "
|
+ "a.id, a.account_name, a.type, a.role_id, a.domain_id, a.state " + "FROM `cloud`.`user` u, `cloud`.`account` a "
|
||||||
+ "WHERE u.account_id = a.id AND u.api_key = ? and u.removed IS NULL";
|
+ "WHERE u.account_id = a.id AND u.api_key = ? and u.removed IS NULL";
|
||||||
|
|
||||||
protected final SearchBuilder<AccountVO> AllFieldsSearch;
|
protected final SearchBuilder<AccountVO> AllFieldsSearch;
|
||||||
@ -53,6 +53,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
protected final SearchBuilder<AccountVO> CleanupForRemovedAccountsSearch;
|
protected final SearchBuilder<AccountVO> CleanupForRemovedAccountsSearch;
|
||||||
protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
|
protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
|
||||||
protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
|
protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
|
||||||
|
protected final SearchBuilder<AccountVO> AccountByRoleSearch;
|
||||||
protected final GenericSearchBuilder<AccountVO, Long> AccountIdsSearch;
|
protected final GenericSearchBuilder<AccountVO, Long> AccountIdsSearch;
|
||||||
|
|
||||||
public AccountDaoImpl() {
|
public AccountDaoImpl() {
|
||||||
@ -96,6 +97,10 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
AccountIdsSearch.selectFields(AccountIdsSearch.entity().getId());
|
AccountIdsSearch.selectFields(AccountIdsSearch.entity().getId());
|
||||||
AccountIdsSearch.and("ids", AccountIdsSearch.entity().getDomainId(), Op.IN);
|
AccountIdsSearch.and("ids", AccountIdsSearch.entity().getDomainId(), Op.IN);
|
||||||
AccountIdsSearch.done();
|
AccountIdsSearch.done();
|
||||||
|
|
||||||
|
AccountByRoleSearch = createSearchBuilder();
|
||||||
|
AccountByRoleSearch.and("roleId", AccountByRoleSearch.entity().getRoleId(), SearchCriteria.Op.EQ);
|
||||||
|
AccountByRoleSearch.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -140,8 +145,9 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
AccountVO a = new AccountVO(rs.getLong(6));
|
AccountVO a = new AccountVO(rs.getLong(6));
|
||||||
a.setAccountName(rs.getString(7));
|
a.setAccountName(rs.getString(7));
|
||||||
a.setType(rs.getShort(8));
|
a.setType(rs.getShort(8));
|
||||||
a.setDomainId(rs.getLong(9));
|
a.setRoleId(rs.getLong(9));
|
||||||
a.setState(State.valueOf(rs.getString(10)));
|
a.setDomainId(rs.getLong(10));
|
||||||
|
a.setState(State.valueOf(rs.getString(11)));
|
||||||
|
|
||||||
userAcctPair = new Pair<User, Account>(u, a);
|
userAcctPair = new Pair<User, Account>(u, a);
|
||||||
}
|
}
|
||||||
@ -258,6 +264,13 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AccountVO> findAccountsByRole(Long roleId) {
|
||||||
|
SearchCriteria<AccountVO> sc = AccountByRoleSearch.create();
|
||||||
|
sc.setParameters("roleId", roleId);
|
||||||
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markForCleanup(long accountId) {
|
public void markForCleanup(long accountId) {
|
||||||
AccountVO account = findByIdIncludingRemoved(accountId);
|
AccountVO account = findByIdIncludingRemoved(accountId);
|
||||||
|
|||||||
@ -0,0 +1,120 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "role_permissions")
|
||||||
|
public class RolePermissionVO implements RolePermission {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
@Column(name = "role_id")
|
||||||
|
private long roleId;
|
||||||
|
|
||||||
|
@Column(name = "rule")
|
||||||
|
private String rule;
|
||||||
|
|
||||||
|
@Column(name = "permission", nullable = false)
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private Permission permission = RolePermission.Permission.DENY;
|
||||||
|
|
||||||
|
@Column(name = "description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = "sort_order")
|
||||||
|
private long sortOrder = 0;
|
||||||
|
|
||||||
|
public RolePermissionVO() {
|
||||||
|
this.uuid = UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolePermissionVO(final long roleId, final String rule, final Permission permission, final String description) {
|
||||||
|
this();
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.rule = rule;
|
||||||
|
this.permission = permission;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(long roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rule getRule() {
|
||||||
|
return new Rule(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRule(String rule) {
|
||||||
|
this.rule = rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Permission getPermission() {
|
||||||
|
return permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermission(Permission permission) {
|
||||||
|
this.permission = permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSortOrder() {
|
||||||
|
return sortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortOrder(long sortOrder) {
|
||||||
|
this.sortOrder = sortOrder;
|
||||||
|
}
|
||||||
|
}
|
||||||
106
engine/schema/src/org/apache/cloudstack/acl/RoleVO.java
Normal file
106
engine/schema/src/org/apache/cloudstack/acl/RoleVO.java
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "roles")
|
||||||
|
public class RoleVO implements Role {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
@Column(name = "name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "role_type", nullable = false)
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private RoleType roleType = RoleType.User;
|
||||||
|
|
||||||
|
@Column(name = "description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = GenericDao.REMOVED_COLUMN)
|
||||||
|
private Date removed;
|
||||||
|
|
||||||
|
public RoleVO() {
|
||||||
|
this.uuid = UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleVO(final String name, final RoleType roleType, final String description) {
|
||||||
|
this();
|
||||||
|
this.name = name;
|
||||||
|
this.roleType = roleType;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleVO(final long id, final String name, final RoleType roleType, final String description) {
|
||||||
|
this(name, roleType, description);
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType getRoleType() {
|
||||||
|
return roleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleType(RoleType roleType) {
|
||||||
|
this.roleType = roleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
29
engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java
Normal file
29
engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl.dao;
|
||||||
|
|
||||||
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.acl.RoleVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RoleDao extends GenericDao<RoleVO, Long> {
|
||||||
|
List<RoleVO> findAllByName(String roleName);
|
||||||
|
List<RoleVO> findAllByRoleType(RoleType type);
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl.dao;
|
||||||
|
|
||||||
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
|
import org.apache.cloudstack.acl.RoleVO;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Local(value = {RoleDao.class})
|
||||||
|
public class RoleDaoImpl extends GenericDaoBase<RoleVO, Long> implements RoleDao {
|
||||||
|
private final SearchBuilder<RoleVO> RoleByNameSearch;
|
||||||
|
private final SearchBuilder<RoleVO> RoleByTypeSearch;
|
||||||
|
|
||||||
|
public RoleDaoImpl() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
RoleByNameSearch = createSearchBuilder();
|
||||||
|
RoleByNameSearch.and("roleName", RoleByNameSearch.entity().getName(), SearchCriteria.Op.LIKE);
|
||||||
|
RoleByNameSearch.done();
|
||||||
|
|
||||||
|
RoleByTypeSearch = createSearchBuilder();
|
||||||
|
RoleByTypeSearch.and("roleType", RoleByTypeSearch.entity().getRoleType(), SearchCriteria.Op.EQ);
|
||||||
|
RoleByTypeSearch.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RoleVO> findAllByName(final String roleName) {
|
||||||
|
SearchCriteria<RoleVO> sc = RoleByNameSearch.create();
|
||||||
|
sc.setParameters("roleName", "%" + roleName + "%");
|
||||||
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RoleVO> findAllByRoleType(final RoleType type) {
|
||||||
|
SearchCriteria<RoleVO> sc = RoleByTypeSearch.create();
|
||||||
|
sc.setParameters("roleType", type);
|
||||||
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl.dao;
|
||||||
|
|
||||||
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RolePermissionVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RolePermissionsDao extends GenericDao<RolePermissionVO, Long> {
|
||||||
|
/**
|
||||||
|
* Adds a new role permission at the end of the list of role permissions
|
||||||
|
* @param item the new role permission
|
||||||
|
* @return returns persisted role permission
|
||||||
|
*/
|
||||||
|
RolePermissionVO persist(final RolePermissionVO item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves an existing role permission under a given parent role permission
|
||||||
|
* @param role the existing role
|
||||||
|
* @param newOrder the new role permissions order
|
||||||
|
* @return returns true on success
|
||||||
|
*/
|
||||||
|
boolean update(final Role role, final List<RolePermission> newOrder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns ordered linked-list of role permission for a given role
|
||||||
|
* @param roleId the ID of the role
|
||||||
|
* @return returns list of role permissions
|
||||||
|
*/
|
||||||
|
List<RolePermissionVO> findAllByRoleIdSorted(Long roleId);
|
||||||
|
}
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package org.apache.cloudstack.acl.dao;
|
||||||
|
|
||||||
|
import com.cloud.utils.db.Attribute;
|
||||||
|
import com.cloud.utils.db.Filter;
|
||||||
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
|
import com.cloud.utils.db.Transaction;
|
||||||
|
import com.cloud.utils.db.TransactionCallback;
|
||||||
|
import com.cloud.utils.db.TransactionStatus;
|
||||||
|
import com.cloud.utils.db.UpdateBuilder;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RolePermission;
|
||||||
|
import org.apache.cloudstack.acl.RolePermissionVO;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Local(value = {RolePermissionsDao.class})
|
||||||
|
public class RolePermissionsDaoImpl extends GenericDaoBase<RolePermissionVO, Long> implements RolePermissionsDao {
|
||||||
|
protected static final Logger LOGGER = Logger.getLogger(RolePermissionsDaoImpl.class);
|
||||||
|
|
||||||
|
private final SearchBuilder<RolePermissionVO> RolePermissionsSearch;
|
||||||
|
private Attribute sortOrderAttribute;
|
||||||
|
|
||||||
|
public RolePermissionsDaoImpl() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
RolePermissionsSearch = createSearchBuilder();
|
||||||
|
RolePermissionsSearch.and("uuid", RolePermissionsSearch.entity().getUuid(), SearchCriteria.Op.EQ);
|
||||||
|
RolePermissionsSearch.and("roleId", RolePermissionsSearch.entity().getRoleId(), SearchCriteria.Op.EQ);
|
||||||
|
RolePermissionsSearch.and("sortOrder", RolePermissionsSearch.entity().getSortOrder(), SearchCriteria.Op.EQ);
|
||||||
|
RolePermissionsSearch.done();
|
||||||
|
|
||||||
|
sortOrderAttribute = _allAttributes.get("sortOrder");
|
||||||
|
|
||||||
|
assert (sortOrderAttribute != null) : "Couldn't find one of these attributes";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean updateSortOrder(final RolePermissionVO permissionBeingMoved, final RolePermissionVO parentPermission) {
|
||||||
|
if (parentPermission != null && permissionBeingMoved.getId() == parentPermission.getId()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final List<RolePermissionVO> newOrderedPermissionsList = new ArrayList<>();
|
||||||
|
// Null parent implies item needs to move to the top
|
||||||
|
if (parentPermission == null) {
|
||||||
|
newOrderedPermissionsList.add(permissionBeingMoved);
|
||||||
|
}
|
||||||
|
for (final RolePermissionVO permission : findAllByRoleIdSorted(permissionBeingMoved.getRoleId())) {
|
||||||
|
if (permission.getId() == permissionBeingMoved.getId()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
newOrderedPermissionsList.add(permission);
|
||||||
|
if (parentPermission != null && permission.getId() == parentPermission.getId()) {
|
||||||
|
newOrderedPermissionsList.add(permissionBeingMoved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long sortOrder = 0L;
|
||||||
|
for (final RolePermissionVO permission : newOrderedPermissionsList) {
|
||||||
|
permission.setSortOrder(sortOrder++);
|
||||||
|
if (!update(permission.getId(), permission)) {
|
||||||
|
LOGGER.warn("Failed to update item's sort order with id:" + permission.getId() + " while moving permission with id:" + permissionBeingMoved.getId() + " to a new position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RolePermissionVO persist(final RolePermissionVO item) {
|
||||||
|
item.setSortOrder(0);
|
||||||
|
final List<RolePermissionVO> permissionsList = findAllByRoleIdSorted(item.getRoleId());
|
||||||
|
if (permissionsList != null && permissionsList.size() > 0) {
|
||||||
|
RolePermission lastRule = permissionsList.get(permissionsList.size() - 1);
|
||||||
|
item.setSortOrder(lastRule.getSortOrder() + 1);
|
||||||
|
}
|
||||||
|
return super.persist(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(final Role role, final List<RolePermission> newOrder) {
|
||||||
|
if (role == null || newOrder == null || newOrder.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Transaction.execute(new TransactionCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean doInTransaction(TransactionStatus status) {
|
||||||
|
final String failMessage = "The role's rule permissions list has changed while you were making updates, aborted re-ordering of rules. Please try again.";
|
||||||
|
final List<RolePermissionVO> currentOrder = findAllByRoleIdSorted(role.getId());
|
||||||
|
if (role.getId() < 1L || newOrder.size() != currentOrder.size()) {
|
||||||
|
throw new CloudRuntimeException(failMessage);
|
||||||
|
}
|
||||||
|
final Set<Long> newOrderSet = new HashSet<>();
|
||||||
|
for (final RolePermission permission : newOrder) {
|
||||||
|
if (permission == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
newOrderSet.add(permission.getId());
|
||||||
|
}
|
||||||
|
final Set<Long> currentOrderSet = new HashSet<>();
|
||||||
|
for (final RolePermission permission : currentOrder) {
|
||||||
|
currentOrderSet.add(permission.getId());
|
||||||
|
}
|
||||||
|
if (!newOrderSet.equals(currentOrderSet)) {
|
||||||
|
throw new CloudRuntimeException(failMessage);
|
||||||
|
}
|
||||||
|
long sortOrder = 0L;
|
||||||
|
for (RolePermission rolePermission : newOrder) {
|
||||||
|
final SearchCriteria<RolePermissionVO> sc = RolePermissionsSearch.create();
|
||||||
|
sc.setParameters("uuid", rolePermission.getUuid());
|
||||||
|
sc.setParameters("roleId", role.getId());
|
||||||
|
sc.setParameters("sortOrder", rolePermission.getSortOrder());
|
||||||
|
|
||||||
|
final UpdateBuilder ub = getUpdateBuilder(rolePermission);
|
||||||
|
ub.set(rolePermission, sortOrderAttribute, sortOrder);
|
||||||
|
final int result = update(ub, sc, null);
|
||||||
|
if (result < 1) {
|
||||||
|
throw new CloudRuntimeException(failMessage);
|
||||||
|
}
|
||||||
|
sortOrder++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RolePermissionVO> findAllByRoleIdSorted(final Long roleId) {
|
||||||
|
final SearchCriteria<RolePermissionVO> sc = RolePermissionsSearch.create();
|
||||||
|
if (roleId != null && roleId > 0L) {
|
||||||
|
sc.setParameters("roleId", roleId);
|
||||||
|
}
|
||||||
|
final Filter searchBySorted = new Filter(RolePermissionVO.class, "sortOrder", true, null, null);
|
||||||
|
searchBySorted.addOrderBy(RolePermissionVO.class, "id", true);
|
||||||
|
final List<RolePermissionVO> rolePermissionList = listBy(sc, searchBySorted);
|
||||||
|
if (rolePermissionList == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return rolePermissionList;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
plugins/acl/dynamic-role-based/pom.xml
Normal file
32
plugins/acl/dynamic-role-based/pom.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>cloud-plugin-acl-dynamic-role-based</artifactId>
|
||||||
|
<name>Apache CloudStack Plugin - ACL Dynamic Role Based</name>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
|
<artifactId>cloudstack-plugins</artifactId>
|
||||||
|
<version>4.9.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
name=acl-dynamic-role-based
|
||||||
|
parent=api
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||||
|
>
|
||||||
|
|
||||||
|
<bean id="DynamicRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.DynamicRoleBasedAPIAccessChecker" >
|
||||||
|
<property name="services" value="#{apiCommandsRegistry.registered}" />
|
||||||
|
</bean>
|
||||||
|
</beans>
|
||||||
@ -0,0 +1,144 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.user.AccountService;
|
||||||
|
import com.cloud.user.User;
|
||||||
|
import com.cloud.utils.component.AdapterBase;
|
||||||
|
import com.cloud.utils.component.PluggableService;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.naming.ConfigurationException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Local(value = APIChecker.class)
|
||||||
|
public class DynamicRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AccountService accountService;
|
||||||
|
@Inject
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
|
private List<PluggableService> services;
|
||||||
|
private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<>();
|
||||||
|
|
||||||
|
protected DynamicRoleBasedAPIAccessChecker() {
|
||||||
|
super();
|
||||||
|
for (RoleType roleType : RoleType.values()) {
|
||||||
|
annotationRoleBasedApisMap.put(roleType, new HashSet<String>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void denyApiAccess(final String commandName) throws PermissionDeniedException {
|
||||||
|
throw new PermissionDeniedException("The API does not exist or is blacklisted for the account's role. " +
|
||||||
|
"The account with is not allowed to request the api: " + commandName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return !roleService.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkAccess(User user, String commandName) throws PermissionDeniedException {
|
||||||
|
if (isDisabled()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Account account = accountService.getAccount(user.getAccountId());
|
||||||
|
if (account == null) {
|
||||||
|
throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Role accountRole = roleService.findRole(account.getRoleId());
|
||||||
|
if (accountRole == null || accountRole.getId() < 1L) {
|
||||||
|
denyApiAccess(commandName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow all APIs for root admins
|
||||||
|
if (accountRole.getRoleType() == RoleType.Admin && accountRole.getId() == RoleType.Admin.getId()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check against current list of permissions
|
||||||
|
for (final RolePermission permission : roleService.findAllPermissionsBy(accountRole.getId())) {
|
||||||
|
if (permission.getRule().matches(commandName)) {
|
||||||
|
if (RolePermission.Permission.ALLOW.equals(permission.getPermission())) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
denyApiAccess(commandName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check annotations
|
||||||
|
if (annotationRoleBasedApisMap.get(accountRole.getRoleType()) != null
|
||||||
|
&& annotationRoleBasedApisMap.get(accountRole.getRoleType()).contains(commandName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default deny all
|
||||||
|
denyApiAccess(commandName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addApiToRoleBasedAnnotationsMap(final RoleType roleType, final String commandName) {
|
||||||
|
if (roleType == null || Strings.isNullOrEmpty(commandName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Set<String> commands = annotationRoleBasedApisMap.get(roleType);
|
||||||
|
if (commands != null && !commands.contains(commandName)) {
|
||||||
|
commands.add(commandName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||||
|
super.configure(name, params);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean start() {
|
||||||
|
for (PluggableService service : services) {
|
||||||
|
for (Class<?> clz : service.getCommands()) {
|
||||||
|
APICommand command = clz.getAnnotation(APICommand.class);
|
||||||
|
for (RoleType role : command.authorized()) {
|
||||||
|
addApiToRoleBasedAnnotationsMap(role, command.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PluggableService> getServices() {
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public void setServices(List<PluggableService> services) {
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,164 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.user.AccountService;
|
||||||
|
import com.cloud.user.AccountVO;
|
||||||
|
import com.cloud.user.User;
|
||||||
|
import com.cloud.user.UserVO;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
public class DynamicRoleBasedAPIAccessCheckerTest extends TestCase {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private AccountService accountService;
|
||||||
|
@Mock
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
|
private DynamicRoleBasedAPIAccessChecker apiAccessChecker;
|
||||||
|
|
||||||
|
private User getTestUser() {
|
||||||
|
return new UserVO(12L, "some user", "password", "firstName", "lastName",
|
||||||
|
"email@gmail.com", "GMT", "uuid", User.Source.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Account getTestAccount() {
|
||||||
|
return new AccountVO("some name", 1L, "network-domain", (short)0, "some-uuid");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Role getTestRole() {
|
||||||
|
return new RoleVO(4L, "SomeRole", RoleType.User, "some description");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupMockField(final Object obj, final String fieldName, final Object mock) throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
Field roleDaoField = DynamicRoleBasedAPIAccessChecker.class.getDeclaredField(fieldName);
|
||||||
|
roleDaoField.setAccessible(true);
|
||||||
|
roleDaoField.set(obj, mock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Before
|
||||||
|
public void setUp() throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
apiAccessChecker = Mockito.spy(new DynamicRoleBasedAPIAccessChecker());
|
||||||
|
setupMockField(apiAccessChecker, "accountService", accountService);
|
||||||
|
setupMockField(apiAccessChecker, "roleService", roleService);
|
||||||
|
|
||||||
|
Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(getTestAccount());
|
||||||
|
Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn((RoleVO) getTestRole());
|
||||||
|
|
||||||
|
// Enabled plugin
|
||||||
|
Mockito.doReturn(false).when(apiAccessChecker).isDisabled();
|
||||||
|
Mockito.doCallRealMethod().when(apiAccessChecker).checkAccess(Mockito.any(User.class), Mockito.anyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvalidAccountCheckAccess() {
|
||||||
|
Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(null);
|
||||||
|
try {
|
||||||
|
apiAccessChecker.checkAccess(getTestUser(), "someApi");
|
||||||
|
fail("Exception was expected");
|
||||||
|
} catch (PermissionDeniedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvalidAccountRoleCheckAccess() {
|
||||||
|
Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn(null);
|
||||||
|
try {
|
||||||
|
apiAccessChecker.checkAccess(getTestUser(), "someApi");
|
||||||
|
fail("Exception was expected");
|
||||||
|
} catch (PermissionDeniedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDefaultRootAdminAccess() {
|
||||||
|
Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(new AccountVO("root admin", 1L, null, (short)1, "some-uuid"));
|
||||||
|
Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn(new RoleVO(1L, "SomeRole", RoleType.Admin, "default root admin role"));
|
||||||
|
assertTrue(apiAccessChecker.checkAccess(getTestUser(), "anyApi"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvalidRolePermissionsCheckAccess() {
|
||||||
|
Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.<RolePermission>emptyList());
|
||||||
|
try {
|
||||||
|
apiAccessChecker.checkAccess(getTestUser(), "someApi");
|
||||||
|
fail("Exception was expected");
|
||||||
|
} catch (PermissionDeniedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidAllowRolePermissionApiCheckAccess() {
|
||||||
|
final String allowedApiName = "someAllowedApi";
|
||||||
|
final RolePermission permission = new RolePermissionVO(1L, allowedApiName, RolePermission.Permission.ALLOW, null);
|
||||||
|
Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
|
||||||
|
assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidAllowRolePermissionWildcardCheckAccess() {
|
||||||
|
final String allowedApiName = "someAllowedApi";
|
||||||
|
final RolePermission permission = new RolePermissionVO(1L, "some*", RolePermission.Permission.ALLOW, null);
|
||||||
|
Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
|
||||||
|
assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidDenyRolePermissionApiCheckAccess() {
|
||||||
|
final String denyApiName = "someDeniedApi";
|
||||||
|
final RolePermission permission = new RolePermissionVO(1L, denyApiName, RolePermission.Permission.DENY, null);
|
||||||
|
Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
|
||||||
|
try {
|
||||||
|
apiAccessChecker.checkAccess(getTestUser(), denyApiName);
|
||||||
|
fail("Exception was expected");
|
||||||
|
} catch (PermissionDeniedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValidDenyRolePermissionWildcardCheckAccess() {
|
||||||
|
final String denyApiName = "someDenyApi";
|
||||||
|
final RolePermission permission = new RolePermissionVO(1L, "*Deny*", RolePermission.Permission.DENY, null);
|
||||||
|
Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
|
||||||
|
try {
|
||||||
|
apiAccessChecker.checkAccess(getTestUser(), denyApiName);
|
||||||
|
fail("Exception was expected");
|
||||||
|
} catch (PermissionDeniedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAnnotationFallbackCheckAccess() {
|
||||||
|
final String allowedApiName = "someApiWithAnnotations";
|
||||||
|
apiAccessChecker.addApiToRoleBasedAnnotationsMap(getTestRole().getRoleType(), allowedApiName);
|
||||||
|
assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -41,18 +41,20 @@ import com.cloud.utils.component.PluggableService;
|
|||||||
// based on the account type, access is granted
|
// based on the account type, access is granted
|
||||||
public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
|
public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
|
||||||
|
|
||||||
protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
|
protected static final Logger LOGGER = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
|
||||||
|
|
||||||
Set<String> commandPropertyFiles = new HashSet<String>();
|
private Set<String> commandPropertyFiles = new HashSet<String>();
|
||||||
Set<String> commandsPropertiesOverrides = new HashSet<String>();
|
private Set<String> commandsPropertiesOverrides = new HashSet<String>();
|
||||||
Map<RoleType, Set<String>> commandsPropertiesRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
|
private Map<RoleType, Set<String>> commandsPropertiesRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
|
||||||
Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
|
private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
|
||||||
|
private List<PluggableService> services;
|
||||||
|
|
||||||
List<PluggableService> _services;
|
|
||||||
@Inject
|
@Inject
|
||||||
AccountService _accountService;
|
private AccountService accountService;
|
||||||
|
@Inject
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
protected StaticRoleBasedAPIAccessChecker() {
|
public StaticRoleBasedAPIAccessChecker() {
|
||||||
super();
|
super();
|
||||||
for (RoleType roleType : RoleType.values()) {
|
for (RoleType roleType : RoleType.values()) {
|
||||||
commandsPropertiesRoleBasedApisMap.put(roleType, new HashSet<String>());
|
commandsPropertiesRoleBasedApisMap.put(roleType, new HashSet<String>());
|
||||||
@ -60,23 +62,31 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return roleService.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkAccess(User user, String commandName) throws PermissionDeniedException {
|
public boolean checkAccess(User user, String commandName) throws PermissionDeniedException {
|
||||||
Account account = _accountService.getAccount(user.getAccountId());
|
if (isDisabled()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Account account = accountService.getAccount(user.getAccountId());
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
|
throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
RoleType roleType = _accountService.getRoleType(account);
|
RoleType roleType = accountService.getRoleType(account);
|
||||||
boolean isAllowed =
|
boolean isAllowed =
|
||||||
commandsPropertiesOverrides.contains(commandName) ? commandsPropertiesRoleBasedApisMap.get(roleType).contains(commandName) : annotationRoleBasedApisMap.get(
|
commandsPropertiesOverrides.contains(commandName) ? commandsPropertiesRoleBasedApisMap.get(roleType).contains(commandName) : annotationRoleBasedApisMap.get(
|
||||||
roleType).contains(commandName);
|
roleType).contains(commandName);
|
||||||
|
|
||||||
if (!isAllowed) {
|
if (isAllowed) {
|
||||||
throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " +
|
return true;
|
||||||
commandName);
|
|
||||||
}
|
}
|
||||||
return isAllowed;
|
|
||||||
|
throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " + commandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,7 +101,7 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean start() {
|
public boolean start() {
|
||||||
for (PluggableService service : _services) {
|
for (PluggableService service : services) {
|
||||||
for (Class<?> clz : service.getCommands()) {
|
for (Class<?> clz : service.getCommands()) {
|
||||||
APICommand command = clz.getAnnotation(APICommand.class);
|
APICommand command = clz.getAnnotation(APICommand.class);
|
||||||
for (RoleType role : command.authorized()) {
|
for (RoleType role : command.authorized()) {
|
||||||
@ -112,22 +122,22 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
|
|||||||
try {
|
try {
|
||||||
short cmdPermissions = Short.parseShort(roleMask);
|
short cmdPermissions = Short.parseShort(roleMask);
|
||||||
for (RoleType roleType : RoleType.values()) {
|
for (RoleType roleType : RoleType.values()) {
|
||||||
if ((cmdPermissions & roleType.getValue()) != 0)
|
if ((cmdPermissions & roleType.getMask()) != 0)
|
||||||
commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
|
commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
s_logger.info("Malformed key=value pair for entry: " + entry.toString());
|
LOGGER.info("Malformed key=value pair for entry: " + entry.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PluggableService> getServices() {
|
public List<PluggableService> getServices() {
|
||||||
return _services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public void setServices(List<PluggableService> services) {
|
public void setServices(List<PluggableService> services) {
|
||||||
this._services = services;
|
this.services = services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getCommandPropertyFiles() {
|
public Set<String> getCommandPropertyFiles() {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.discovery;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -38,7 +39,7 @@ import com.cloud.user.User;
|
|||||||
description = "lists all available apis on the server, provided by the Api Discovery plugin",
|
description = "lists all available apis on the server, provided by the Api Discovery plugin",
|
||||||
since = "4.1.0",
|
since = "4.1.0",
|
||||||
requestHasSensitiveInfo = false,
|
requestHasSensitiveInfo = false,
|
||||||
responseHasSensitiveInfo = false)
|
responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||||
public class ListApisCmd extends BaseCmd {
|
public class ListApisCmd extends BaseCmd {
|
||||||
|
|
||||||
public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName());
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import com.cloud.utils.db.SearchCriteria;
|
|||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.AddBaremetalRctCmd;
|
import org.apache.cloudstack.api.AddBaremetalRctCmd;
|
||||||
import org.apache.cloudstack.api.DeleteBaremetalRctCmd;
|
import org.apache.cloudstack.api.DeleteBaremetalRctCmd;
|
||||||
import org.apache.cloudstack.api.ListBaremetalRctCmd;
|
import org.apache.cloudstack.api.ListBaremetalRctCmd;
|
||||||
@ -247,6 +248,8 @@ public class BaremetalVlanManagerImpl extends ManagerBase implements BaremetalVl
|
|||||||
acnt.setUuid(UUID.randomUUID().toString());
|
acnt.setUuid(UUID.randomUUID().toString());
|
||||||
acnt.setState(Account.State.enabled);
|
acnt.setState(Account.State.enabled);
|
||||||
acnt.setDomainId(1);
|
acnt.setDomainId(1);
|
||||||
|
acnt.setType(RoleType.User.getAccountType());
|
||||||
|
acnt.setRoleId(RoleType.User.getId());
|
||||||
acnt = acntDao.persist(acnt);
|
acnt = acntDao.persist(acnt);
|
||||||
|
|
||||||
UserVO user = new UserVO();
|
UserVO user = new UserVO();
|
||||||
|
|||||||
@ -134,14 +134,14 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserAccount createUserAccount(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, short arg7, Long arg8, String arg9,
|
public UserAccount createUserAccount(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, short arg7, Long roleId, Long arg8, String arg9,
|
||||||
Map<String, String> arg10, String arg11, String arg12) {
|
Map<String, String> arg10, String arg11, String arg12) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
|
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId,
|
||||||
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
|
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
@ -392,8 +392,8 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
|
public Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
|
||||||
final AccountVO account = new AccountVO(accountName, domainId, networkDomain, accountType, uuid);
|
final AccountVO account = new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid);
|
||||||
Transaction.execute(new TransactionCallbackNoReturn() {
|
Transaction.execute(new TransactionCallbackNoReturn() {
|
||||||
@Override
|
@Override
|
||||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
<module>api/solidfire-intg-test</module>
|
<module>api/solidfire-intg-test</module>
|
||||||
<module>api/discovery</module>
|
<module>api/discovery</module>
|
||||||
<module>acl/static-role-based</module>
|
<module>acl/static-role-based</module>
|
||||||
|
<module>acl/dynamic-role-based</module>
|
||||||
<module>affinity-group-processors/host-anti-affinity</module>
|
<module>affinity-group-processors/host-anti-affinity</module>
|
||||||
<module>affinity-group-processors/explicit-dedication</module>
|
<module>affinity-group-processors/explicit-dedication</module>
|
||||||
<module>deployment-planners/user-concentrated-pod</module>
|
<module>deployment-planners/user-concentrated-pod</module>
|
||||||
|
|||||||
@ -16,12 +16,12 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api.command;
|
package org.apache.cloudstack.api.command;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import com.cloud.domain.DomainVO;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import com.cloud.user.Account;
|
||||||
import java.security.SecureRandom;
|
import com.cloud.user.AccountService;
|
||||||
import java.util.Map;
|
import com.cloud.user.User;
|
||||||
|
import com.cloud.user.UserAccount;
|
||||||
import javax.inject.Inject;
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
@ -31,6 +31,7 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
|||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.response.AccountResponse;
|
import org.apache.cloudstack.api.response.AccountResponse;
|
||||||
import org.apache.cloudstack.api.response.DomainResponse;
|
import org.apache.cloudstack.api.response.DomainResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
import org.apache.cloudstack.ldap.LdapManager;
|
import org.apache.cloudstack.ldap.LdapManager;
|
||||||
import org.apache.cloudstack.ldap.LdapUser;
|
import org.apache.cloudstack.ldap.LdapUser;
|
||||||
@ -38,11 +39,11 @@ import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.bouncycastle.util.encoders.Base64;
|
import org.bouncycastle.util.encoders.Base64;
|
||||||
|
|
||||||
import com.cloud.domain.DomainVO;
|
import javax.inject.Inject;
|
||||||
import com.cloud.user.Account;
|
import java.io.UnsupportedEncodingException;
|
||||||
import com.cloud.user.AccountService;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import com.cloud.user.User;
|
import java.security.SecureRandom;
|
||||||
import com.cloud.user.UserAccount;
|
import java.util.Map;
|
||||||
|
|
||||||
@APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
@APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||||
public class LdapCreateAccountCmd extends BaseCmd {
|
public class LdapCreateAccountCmd extends BaseCmd {
|
||||||
@ -55,9 +56,12 @@ public class LdapCreateAccountCmd extends BaseCmd {
|
|||||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
|
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
|
||||||
private String accountName;
|
private String accountName;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.SHORT, required = true, description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
@Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.SHORT, description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
||||||
private Short accountType;
|
private Short accountType;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
|
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
|
||||||
private Long domainId;
|
private Long domainId;
|
||||||
|
|
||||||
@ -92,7 +96,7 @@ public class LdapCreateAccountCmd extends BaseCmd {
|
|||||||
UserAccount createCloudstackUserAccount(final LdapUser user, String accountName, Long domainId) {
|
UserAccount createCloudstackUserAccount(final LdapUser user, String accountName, Long domainId) {
|
||||||
Account account = _accountService.getActiveAccountByName(accountName, domainId);
|
Account account = _accountService.getActiveAccountByName(accountName, domainId);
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, accountType,
|
return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, getAccountType(), getRoleId(),
|
||||||
domainId, networkDomain, details, accountUUID, userUUID, User.Source.LDAP);
|
domainId, networkDomain, details, accountUUID, userUUID, User.Source.LDAP);
|
||||||
} else {
|
} else {
|
||||||
User newUser = _accountService.createUser(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, domainId,
|
User newUser = _accountService.createUser(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, domainId,
|
||||||
@ -101,6 +105,14 @@ public class LdapCreateAccountCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Short getAccountType() {
|
||||||
|
return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return RoleType.getRoleByAccountType(roleId, accountType);
|
||||||
|
}
|
||||||
|
|
||||||
private String getAccountName() {
|
private String getAccountName() {
|
||||||
String name = accountName;
|
String name = accountName;
|
||||||
if (accountName == null) {
|
if (accountName == null) {
|
||||||
@ -119,6 +131,9 @@ public class LdapCreateAccountCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ServerApiException {
|
public void execute() throws ServerApiException {
|
||||||
|
if (getAccountType() == null && getRoleId() == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Both account type and role ID are not provided");
|
||||||
|
}
|
||||||
final CallContext callContext = getCurrentContext();
|
final CallContext callContext = getCurrentContext();
|
||||||
String finalAccountName = getAccountName();
|
String finalAccountName = getAccountName();
|
||||||
Long finalDomainId = getDomainId();
|
Long finalDomainId = getDomainId();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import javax.inject.Inject;
|
|||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.user.UserAccount;
|
import com.cloud.user.UserAccount;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
@ -38,6 +39,7 @@ import org.apache.cloudstack.api.ServerApiException;
|
|||||||
import org.apache.cloudstack.api.response.DomainResponse;
|
import org.apache.cloudstack.api.response.DomainResponse;
|
||||||
import org.apache.cloudstack.api.response.LdapUserResponse;
|
import org.apache.cloudstack.api.response.LdapUserResponse;
|
||||||
import org.apache.cloudstack.api.response.ListResponse;
|
import org.apache.cloudstack.api.response.ListResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RoleResponse;
|
||||||
import org.apache.cloudstack.ldap.LdapManager;
|
import org.apache.cloudstack.ldap.LdapManager;
|
||||||
import org.apache.cloudstack.ldap.LdapUser;
|
import org.apache.cloudstack.ldap.LdapUser;
|
||||||
import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException;
|
import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException;
|
||||||
@ -70,10 +72,12 @@ public class LdapImportUsersCmd extends BaseListCmd {
|
|||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_TYPE,
|
@Parameter(name = ApiConstants.ACCOUNT_TYPE,
|
||||||
type = CommandType.SHORT,
|
type = CommandType.SHORT,
|
||||||
required = true,
|
|
||||||
description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
|
||||||
private Short accountType;
|
private Short accountType;
|
||||||
|
|
||||||
|
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
||||||
private Map<String, String> details;
|
private Map<String, String> details;
|
||||||
|
|
||||||
@ -112,7 +116,7 @@ public class LdapImportUsersCmd extends BaseListCmd {
|
|||||||
Account account = _accountService.getActiveAccountByName(accountName, domain.getId());
|
Account account = _accountService.getActiveAccountByName(accountName, domain.getId());
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
s_logger.debug("No account exists with name: " + accountName + " creating the account and an user with name: " + user.getUsername() + " in the account");
|
s_logger.debug("No account exists with name: " + accountName + " creating the account and an user with name: " + user.getUsername() + " in the account");
|
||||||
_accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, accountType,
|
_accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, getAccountType(), getRoleId(),
|
||||||
domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
||||||
} else {
|
} else {
|
||||||
// check if the user exists. if yes, call update
|
// check if the user exists. if yes, call update
|
||||||
@ -131,7 +135,9 @@ public class LdapImportUsersCmd extends BaseListCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||||
ResourceAllocationException, NetworkRuleConflictException {
|
ResourceAllocationException, NetworkRuleConflictException {
|
||||||
|
if (getAccountType() == null && getRoleId() == null) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Both account type and role ID are not provided");
|
||||||
|
}
|
||||||
List<LdapUser> users;
|
List<LdapUser> users;
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isNotBlank(groupName)) {
|
if (StringUtils.isNotBlank(groupName)) {
|
||||||
@ -161,6 +167,14 @@ public class LdapImportUsersCmd extends BaseListCmd {
|
|||||||
setResponseObject(response);
|
setResponseObject(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Short getAccountType() {
|
||||||
|
return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return RoleType.getRoleByAccountType(roleId, accountType);
|
||||||
|
}
|
||||||
|
|
||||||
private String getAccountName(LdapUser user) {
|
private String getAccountName(LdapUser user) {
|
||||||
String finalAccountName = accountName;
|
String finalAccountName = accountName;
|
||||||
if(finalAccountName == null ) {
|
if(finalAccountName == null ) {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import javax.inject.Inject;
|
|||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.user.UserAccount;
|
import com.cloud.user.UserAccount;
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
@ -82,7 +83,7 @@ public class LinkDomainToLdapCmd extends BaseCmd {
|
|||||||
if (account == null) {
|
if (account == null) {
|
||||||
try {
|
try {
|
||||||
UserAccount userAccount = _accountService.createUserAccount(admin, "", ldapUser.getFirstname(), ldapUser.getLastname(), ldapUser.getEmail(), null,
|
UserAccount userAccount = _accountService.createUserAccount(admin, "", ldapUser.getFirstname(), ldapUser.getLastname(), ldapUser.getEmail(), null,
|
||||||
admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, domainId, null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, RoleType.DomainAdmin.getId(), domainId, null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
||||||
response.setAdminId(String.valueOf(userAccount.getAccountId()));
|
response.setAdminId(String.valueOf(userAccount.getAccountId()));
|
||||||
s_logger.info("created an account with name " + admin + " in the given domain " + domainId);
|
s_logger.info("created an account with name " + admin + " in the given domain " + domainId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@ -119,7 +120,8 @@ public class LdapAuthenticator extends AdapterBase implements UserAuthenticator
|
|||||||
|
|
||||||
private void createCloudStackUserAccount(LdapUser user, long domainId, short accountType) {
|
private void createCloudStackUserAccount(LdapUser user, long domainId, short accountType) {
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
_accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, username, accountType, domainId, null, null,
|
_accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, username,
|
||||||
|
accountType, RoleType.getByAccountType(accountType).getId(), domainId, null, null,
|
||||||
UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -246,7 +246,7 @@ class LdapImportUsersCmdSpec extends spock.lang.Specification {
|
|||||||
1 * accountService.getActiveAccountByName('ACCOUNT', 0) >> Mock(AccountVO)
|
1 * accountService.getActiveAccountByName('ACCOUNT', 0) >> Mock(AccountVO)
|
||||||
1 * accountService.getActiveUserAccount('rmurphy',0) >> Mock(UserAccountVO)
|
1 * accountService.getActiveUserAccount('rmurphy',0) >> Mock(UserAccountVO)
|
||||||
0 * accountService.createUser('rmurphy', _ , 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 0, _) >> Mock(UserVO)
|
0 * accountService.createUser('rmurphy', _ , 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 0, _) >> Mock(UserVO)
|
||||||
0 * accountService.createUserAccount('rmurphy', _, 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 2, 0, 'DOMAIN', null, _, _)
|
0 * accountService.createUserAccount('rmurphy', _, 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 2, null, 0, 'DOMAIN', null, _, _)
|
||||||
1 * accountService.updateUser(_,'Ryan', 'Murphy', 'rmurphy@test.com', null, null, null, null, null);
|
1 * accountService.updateUser(_,'Ryan', 'Murphy', 'rmurphy@test.com', null, null, null, null, null);
|
||||||
|
|
||||||
def ldapImportUsersCmd = new LdapImportUsersCmd(ldapManager, domainService, accountService)
|
def ldapImportUsersCmd = new LdapImportUsersCmd(ldapManager, domainService, accountService)
|
||||||
|
|||||||
136
scripts/util/migrate-dynamicroles.py
Executable file
136
scripts/util/migrate-dynamicroles.py
Executable file
@ -0,0 +1,136 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from contextlib import closing
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
try:
|
||||||
|
import MySQLdb
|
||||||
|
except ImportError:
|
||||||
|
print("MySQLdb cannot be imported, please install python-mysqldb(apt) or mysql-python(yum)")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
dryrun = False
|
||||||
|
|
||||||
|
|
||||||
|
def runSql(conn, query):
|
||||||
|
if dryrun:
|
||||||
|
print("Running SQL query: " + query)
|
||||||
|
return
|
||||||
|
with closing(conn.cursor()) as cursor:
|
||||||
|
cursor.execute(query)
|
||||||
|
|
||||||
|
|
||||||
|
def migrateApiRolePermissions(apis, conn):
|
||||||
|
# All allow for root admin role Admin(id:1)
|
||||||
|
runSql(conn, "INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0);")
|
||||||
|
# Migrate rules based on commands.properties rule for ResourceAdmin(id:2), DomainAdmin(id:3), User(id:4)
|
||||||
|
octetKey = {2:2, 3:4, 4:8}
|
||||||
|
for role in [2, 3, 4]:
|
||||||
|
sortOrder = 0
|
||||||
|
for api in sorted(apis.keys()):
|
||||||
|
# Ignore auth commands
|
||||||
|
if api in ['login', 'logout', 'samlSso', 'samlSlo', 'listIdps', 'listAndSwitchSamlAccount', 'getSPMetadata']:
|
||||||
|
continue
|
||||||
|
if (octetKey[role] & int(apis[api])) > 0:
|
||||||
|
runSql(conn, "INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), %d, '%s', 'ALLOW', %d);" % (role, api, sortOrder))
|
||||||
|
sortOrder += 1
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = OptionParser()
|
||||||
|
parser.add_option("-b", "--db", action="store", type="string", dest="db", default="cloud",
|
||||||
|
help="The name of the database, default: cloud")
|
||||||
|
parser.add_option("-u", "--user", action="store", type="string", dest="user", default="cloud",
|
||||||
|
help="User name a MySQL user with privileges on cloud database")
|
||||||
|
parser.add_option("-p", "--password", action="store", type="string", dest="password", default="cloud",
|
||||||
|
help="Password of a MySQL user with privileges on cloud database")
|
||||||
|
parser.add_option("-H", "--host", action="store", type="string", dest="host", default="127.0.0.1",
|
||||||
|
help="Host or IP of the MySQL server")
|
||||||
|
parser.add_option("-P", "--port", action="store", type="int", dest="port", default=3306,
|
||||||
|
help="Host or IP of the MySQL server")
|
||||||
|
parser.add_option("-f", "--properties-file", action="store", type="string", dest="commandsfile", default="/etc/cloudstack/management/commands.properties",
|
||||||
|
help="The commands.properties file")
|
||||||
|
parser.add_option("-d", "--dryrun", action="store_true", dest="dryrun", default=False,
|
||||||
|
help="Dry run and debug operations this tool will perform")
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
print("Apache CloudStack Role Permission Migration Tool")
|
||||||
|
print("(c) Apache CloudStack Authors and the ASF, under the Apache License, Version 2.0\n")
|
||||||
|
|
||||||
|
global dryrun
|
||||||
|
if options.dryrun:
|
||||||
|
dryrun = True
|
||||||
|
|
||||||
|
conn = MySQLdb.connect(
|
||||||
|
host=options.host,
|
||||||
|
user=options.user,
|
||||||
|
passwd=options.password,
|
||||||
|
port=int(options.port),
|
||||||
|
db=options.db)
|
||||||
|
|
||||||
|
if not os.path.isfile(options.commandsfile):
|
||||||
|
print("Provided commands.properties cannot be accessed or does not exist, please check check permissions")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
choice = raw_input("Running this migration tool will remove any " +
|
||||||
|
"default-role permissions from cloud.role_permissions. " +
|
||||||
|
"Do you want to continue? [y/N]").lower()
|
||||||
|
if choice == 'y':
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print("Aborting!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Generate API to permission octet map
|
||||||
|
apiMap = {}
|
||||||
|
with open(options.commandsfile) as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
if not line or line == '' or line == '\n' or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
name, value = line.split('=')
|
||||||
|
apiMap[name.strip()] = value.strip()
|
||||||
|
|
||||||
|
# Rename and deprecate old commands.properties file
|
||||||
|
if not dryrun:
|
||||||
|
os.rename(options.commandsfile, options.commandsfile + '.deprecated')
|
||||||
|
print("The commands.properties file has been deprecated and moved at: " + options.commandsfile + '.deprecated')
|
||||||
|
|
||||||
|
# Truncate any rules in cloud.role_permissions table
|
||||||
|
runSql(conn, "DELETE FROM `cloud`.`role_permissions` WHERE `role_id` in (1,2,3,4);")
|
||||||
|
|
||||||
|
# Migrate rules from commands.properties to cloud.role_permissions
|
||||||
|
migrateApiRolePermissions(apiMap, conn)
|
||||||
|
print("Static role permissions from commands.properties have been migrated into the db")
|
||||||
|
|
||||||
|
# Enable dynamic role based API checker
|
||||||
|
runSql(conn, "UPDATE `cloud`.`configuration` SET value='true' where name='dynamic.apichecker.enabled'")
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
print("Dynamic role based API checker has been enabled!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@ -37,6 +37,8 @@
|
|||||||
value="#{pluggableAPIAuthenticatorsRegistry.registered}" />
|
value="#{pluggableAPIAuthenticatorsRegistry.registered}" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="roleManagerImpl" class="org.apache.cloudstack.acl.RoleManagerImpl" />
|
||||||
|
|
||||||
<bean id="accountManagerImpl" class="com.cloud.user.AccountManagerImpl">
|
<bean id="accountManagerImpl" class="com.cloud.user.AccountManagerImpl">
|
||||||
<property name="userAuthenticators"
|
<property name="userAuthenticators"
|
||||||
value="#{userAuthenticatorsRegistry.registered}" />
|
value="#{userAuthenticatorsRegistry.registered}" />
|
||||||
|
|||||||
@ -27,6 +27,8 @@ import java.util.Set;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.acl.Role;
|
||||||
|
import org.apache.cloudstack.acl.RoleService;
|
||||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||||
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
||||||
@ -423,6 +425,7 @@ public class ApiDBUtils {
|
|||||||
static AffinityGroupJoinDao s_affinityGroupJoinDao;
|
static AffinityGroupJoinDao s_affinityGroupJoinDao;
|
||||||
static GlobalLoadBalancingRulesService s_gslbService;
|
static GlobalLoadBalancingRulesService s_gslbService;
|
||||||
static NetworkACLDao s_networkACLDao;
|
static NetworkACLDao s_networkACLDao;
|
||||||
|
static RoleService s_roleService;
|
||||||
static AccountService s_accountService;
|
static AccountService s_accountService;
|
||||||
static ResourceMetaDataService s_resourceDetailsService;
|
static ResourceMetaDataService s_resourceDetailsService;
|
||||||
static HostGpuGroupsDao s_hostGpuGroupsDao;
|
static HostGpuGroupsDao s_hostGpuGroupsDao;
|
||||||
@ -646,6 +649,8 @@ public class ApiDBUtils {
|
|||||||
@Inject
|
@Inject
|
||||||
private NetworkACLDao networkACLDao;
|
private NetworkACLDao networkACLDao;
|
||||||
@Inject
|
@Inject
|
||||||
|
private RoleService roleService;
|
||||||
|
@Inject
|
||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
@Inject
|
@Inject
|
||||||
private ConfigurationManager configMgr;
|
private ConfigurationManager configMgr;
|
||||||
@ -768,6 +773,7 @@ public class ApiDBUtils {
|
|||||||
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
|
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
|
||||||
s_statsCollector = StatsCollector.getInstance();
|
s_statsCollector = StatsCollector.getInstance();
|
||||||
s_networkACLDao = networkACLDao;
|
s_networkACLDao = networkACLDao;
|
||||||
|
s_roleService = roleService;
|
||||||
s_accountService = accountService;
|
s_accountService = accountService;
|
||||||
s_resourceDetailsService = resourceDetailsService;
|
s_resourceDetailsService = resourceDetailsService;
|
||||||
s_hostGpuGroupsDao = hostGpuGroupsDao;
|
s_hostGpuGroupsDao = hostGpuGroupsDao;
|
||||||
@ -1695,6 +1701,15 @@ public class ApiDBUtils {
|
|||||||
|
|
||||||
public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) {
|
public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) {
|
||||||
UserResponse response = s_userAccountJoinDao.newUserResponse(usr);
|
UserResponse response = s_userAccountJoinDao.newUserResponse(usr);
|
||||||
|
// Populate user account role information
|
||||||
|
if (usr.getAccountRoleId() != null) {
|
||||||
|
Role role = s_roleService.findRole( usr.getAccountRoleId());
|
||||||
|
if (role != null) {
|
||||||
|
response.setRoleId(role.getUuid());
|
||||||
|
response.setRoleType(role.getRoleType());
|
||||||
|
response.setRoleName(role.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (domainId != null && usr.getDomainId() != domainId)
|
if (domainId != null && usr.getDomainId() != domainId)
|
||||||
response.setIsCallerChildDomain(true);
|
response.setIsCallerChildDomain(true);
|
||||||
else
|
else
|
||||||
@ -1820,7 +1835,17 @@ public class ApiDBUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static AccountResponse newAccountResponse(ResponseView view, AccountJoinVO ve) {
|
public static AccountResponse newAccountResponse(ResponseView view, AccountJoinVO ve) {
|
||||||
return s_accountJoinDao.newAccountResponse(view, ve);
|
AccountResponse response = s_accountJoinDao.newAccountResponse(view, ve);
|
||||||
|
// Populate account role information
|
||||||
|
if (ve.getRoleId() != null) {
|
||||||
|
Role role = s_roleService.findRole(ve.getRoleId());
|
||||||
|
if (role != null) {
|
||||||
|
response.setRoleId(role.getUuid());
|
||||||
|
response.setRoleType(role.getRoleType());
|
||||||
|
response.setRoleName(role.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccountJoinVO newAccountView(Account e) {
|
public static AccountJoinVO newAccountView(Account e) {
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public class ApiResponseGsonHelper {
|
|||||||
boolean permittedParameter = false;
|
boolean permittedParameter = false;
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
for (RoleType allowedRole : allowedRoles) {
|
for (RoleType allowedRole : allowedRoles) {
|
||||||
if (allowedRole.getValue() == caller.getType()) {
|
if (allowedRole.getAccountType() == caller.getType()) {
|
||||||
permittedParameter = true;
|
permittedParameter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -797,15 +797,15 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
|
|||||||
s_logger.debug(ex.getMessage());
|
s_logger.debug(ex.getMessage());
|
||||||
throw new ServerApiException(ApiErrorCode.API_LIMIT_EXCEED, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.API_LIMIT_EXCEED, ex.getMessage());
|
||||||
} catch (final PermissionDeniedException ex) {
|
} catch (final PermissionDeniedException ex) {
|
||||||
s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
|
s_logger.debug("The user with id:" + userId + " is not allowed to request the API command or the API command does not exist: " + commandName);
|
||||||
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
|
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The user is not allowed to request the API command or the API command does not exist");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// check against every available command to see if the command exists or not
|
// check against every available command to see if the command exists or not
|
||||||
if (!s_apiNameCmdClassMap.containsKey(commandName) && !commandName.equals("login") && !commandName.equals("logout")) {
|
if (!s_apiNameCmdClassMap.containsKey(commandName) && !commandName.equals("login") && !commandName.equals("logout")) {
|
||||||
s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
|
s_logger.debug("The user with id:" + userId + " is not allowed to request the API command or the API command does not exist: " + commandName);
|
||||||
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
|
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The user is not allowed to request the API command or the API command does not exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,9 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||||||
@Column(name = "type")
|
@Column(name = "type")
|
||||||
private short type;
|
private short type;
|
||||||
|
|
||||||
|
@Column(name = "role_id")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
@Column(name = "state")
|
@Column(name = "state")
|
||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
private State state;
|
private State state;
|
||||||
@ -202,6 +205,10 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
public State getState() {
|
public State getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,6 +96,9 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
@Column(name = "account_type")
|
@Column(name = "account_type")
|
||||||
private short accountType;
|
private short accountType;
|
||||||
|
|
||||||
|
@Column(name = "account_role_id")
|
||||||
|
private Long accountRoleId;
|
||||||
|
|
||||||
@Column(name = "domain_id")
|
@Column(name = "domain_id")
|
||||||
private long domainId;
|
private long domainId;
|
||||||
|
|
||||||
@ -149,6 +152,10 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
return accountType;
|
return accountType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getAccountRoleId() {
|
||||||
|
return accountRoleId;
|
||||||
|
}
|
||||||
|
|
||||||
public long getDomainId() {
|
public long getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,7 +251,7 @@ public class ApiResponseSerializer {
|
|||||||
boolean permittedParameter = false;
|
boolean permittedParameter = false;
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
for (RoleType allowedRole : allowedRoles) {
|
for (RoleType allowedRole : allowedRoles) {
|
||||||
if (allowedRole.getValue() == caller.getType()) {
|
if (allowedRole.getAccountType() == caller.getType()) {
|
||||||
permittedParameter = true;
|
permittedParameter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,7 +211,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
|
|||||||
StringBuilder acctNm = new StringBuilder("PrjAcct-");
|
StringBuilder acctNm = new StringBuilder("PrjAcct-");
|
||||||
acctNm.append(name).append("-").append(ownerFinal.getDomainId());
|
acctNm.append(name).append("-").append(ownerFinal.getDomainId());
|
||||||
|
|
||||||
Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, domainId, null, null, UUID.randomUUID().toString());
|
Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, null, domainId, null, null, UUID.randomUUID().toString());
|
||||||
|
|
||||||
Project project = _projectDao.persist(new ProjectVO(name, displayText, ownerFinal.getDomainId(), projectAccount.getId()));
|
Project project = _projectDao.persist(new ProjectVO(name, displayText, ownerFinal.getDomainId(), projectAccount.getId()));
|
||||||
|
|
||||||
|
|||||||
@ -449,7 +449,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||||
TransactionLegacy txn = TransactionLegacy.currentTxn();
|
TransactionLegacy txn = TransactionLegacy.currentTxn();
|
||||||
// insert system account
|
// insert system account
|
||||||
String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', 1)";
|
String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, role_id, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', '1', 1)";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
||||||
@ -476,8 +476,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||||||
String lastname = "cloud";
|
String lastname = "cloud";
|
||||||
|
|
||||||
// create an account for the admin user first
|
// create an account for the admin user first
|
||||||
insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username
|
insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, role_id, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username
|
||||||
+ "', '1', '1', 1)";
|
+ "', '1', '1', '1', 1)";
|
||||||
try {
|
try {
|
||||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public interface AccountManager extends AccountService {
|
|||||||
|
|
||||||
Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
|
Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
|
||||||
|
|
||||||
Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid);
|
Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs out a user
|
* Logs out a user
|
||||||
|
|||||||
@ -994,9 +994,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
||||||
})
|
})
|
||||||
public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email, final String timezone,
|
public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email, final String timezone,
|
||||||
String accountName, final short accountType, Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
|
String accountName, final short accountType, final Long roleId, Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
|
||||||
|
|
||||||
return createUserAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, domainId, networkDomain, details, accountUUID, userUUID,
|
return createUserAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, roleId, domainId, networkDomain, details, accountUUID, userUUID,
|
||||||
User.Source.UNKNOWN);
|
User.Source.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,7 +1011,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
||||||
})
|
})
|
||||||
public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email,
|
public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email,
|
||||||
final String timezone, String accountName, final short accountType, Long domainId, final String networkDomain, final Map<String, String> details,
|
final String timezone, String accountName, final short accountType, final Long roleId, Long domainId, final String networkDomain, final Map<String, String> details,
|
||||||
String accountUUID, final String userUUID, final User.Source source) {
|
String accountUUID, final String userUUID, final User.Source source) {
|
||||||
|
|
||||||
if (accountName == null) {
|
if (accountName == null) {
|
||||||
@ -1065,7 +1065,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
if (accountUUID == null) {
|
if (accountUUID == null) {
|
||||||
accountUUID = UUID.randomUUID().toString();
|
accountUUID = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
AccountVO account = createAccount(accountNameFinal, accountType, domainIdFinal, networkDomain, details, accountUUID);
|
AccountVO account = createAccount(accountNameFinal, accountType, roleId, domainIdFinal, networkDomain, details, accountUUID);
|
||||||
long accountId = account.getId();
|
long accountId = account.getId();
|
||||||
|
|
||||||
// create the first user for the account
|
// create the first user for the account
|
||||||
@ -1869,27 +1869,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RoleType getRoleType(Account account) {
|
public RoleType getRoleType(Account account) {
|
||||||
RoleType roleType = RoleType.Unknown;
|
if (account == null) {
|
||||||
if (account == null)
|
return RoleType.Unknown;
|
||||||
return roleType;
|
|
||||||
short accountType = account.getType();
|
|
||||||
|
|
||||||
// Account type to role type translation
|
|
||||||
switch (accountType) {
|
|
||||||
case Account.ACCOUNT_TYPE_ADMIN:
|
|
||||||
roleType = RoleType.Admin;
|
|
||||||
break;
|
|
||||||
case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
|
|
||||||
roleType = RoleType.DomainAdmin;
|
|
||||||
break;
|
|
||||||
case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
|
|
||||||
roleType = RoleType.ResourceAdmin;
|
|
||||||
break;
|
|
||||||
case Account.ACCOUNT_TYPE_NORMAL:
|
|
||||||
roleType = RoleType.User;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return roleType;
|
return RoleType.getByAccountType(account.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1916,7 +1899,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public AccountVO createAccount(final String accountName, final short accountType, final Long domainId, final String networkDomain, final Map<String, String> details,
|
public AccountVO createAccount(final String accountName, final short accountType, final Long roleId, final Long domainId, final String networkDomain, final Map<String, String> details,
|
||||||
final String uuid) {
|
final String uuid) {
|
||||||
// Validate domain
|
// Validate domain
|
||||||
Domain domain = _domainMgr.getDomain(domainId);
|
Domain domain = _domainMgr.getDomain(domainId);
|
||||||
@ -1929,7 +1912,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((domainId != Domain.ROOT_DOMAIN) && (accountType == Account.ACCOUNT_TYPE_ADMIN)) {
|
if ((domainId != Domain.ROOT_DOMAIN) && (accountType == Account.ACCOUNT_TYPE_ADMIN)) {
|
||||||
throw new InvalidParameterValueException("Invalid account type " + accountType + " given for an account in domain " + domainId + "; unable to create user.");
|
throw new InvalidParameterValueException("Invalid account type " + accountType + " given for an account in domain " + domainId + "; unable to create user of admin role type in non-ROOT domain.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate account/user/domain settings
|
// Validate account/user/domain settings
|
||||||
@ -1961,7 +1944,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
return Transaction.execute(new TransactionCallback<AccountVO>() {
|
return Transaction.execute(new TransactionCallback<AccountVO>() {
|
||||||
@Override
|
@Override
|
||||||
public AccountVO doInTransaction(TransactionStatus status) {
|
public AccountVO doInTransaction(TransactionStatus status) {
|
||||||
AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, uuid));
|
AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid));
|
||||||
|
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId);
|
throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId);
|
||||||
|
|||||||
264
server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
Normal file
264
server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
|
import com.cloud.event.ActionEvent;
|
||||||
|
import com.cloud.event.EventTypes;
|
||||||
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.user.dao.AccountDao;
|
||||||
|
import com.cloud.utils.ListUtils;
|
||||||
|
import com.cloud.utils.PropertiesUtil;
|
||||||
|
import com.cloud.utils.component.ManagerBase;
|
||||||
|
import com.cloud.utils.component.PluggableService;
|
||||||
|
import com.cloud.utils.db.Transaction;
|
||||||
|
import com.cloud.utils.db.TransactionCallback;
|
||||||
|
import com.cloud.utils.db.TransactionStatus;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.cloudstack.acl.dao.RoleDao;
|
||||||
|
import org.apache.cloudstack.acl.dao.RolePermissionsDao;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.CreateRoleCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.CreateRolePermissionCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.DeleteRoleCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.DeleteRolePermissionCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.ListRolePermissionsCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.ListRolesCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.UpdateRoleCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.acl.UpdateRolePermissionCmd;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||||
|
import org.apache.cloudstack.framework.config.Configurable;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Local(value = {RoleService.class})
|
||||||
|
public class RoleManagerImpl extends ManagerBase implements RoleService, Configurable, PluggableService {
|
||||||
|
@Inject
|
||||||
|
private AccountDao accountDao;
|
||||||
|
@Inject
|
||||||
|
private RoleDao roleDao;
|
||||||
|
@Inject
|
||||||
|
private RolePermissionsDao rolePermissionsDao;
|
||||||
|
|
||||||
|
private void checkCallerAccess() {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
throw new PermissionDeniedException("Dynamic api checker is not enabled, aborting role operation");
|
||||||
|
}
|
||||||
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
|
if (caller == null || caller.getRoleId() == null) {
|
||||||
|
throw new PermissionDeniedException("Restricted API called by an invalid user account");
|
||||||
|
}
|
||||||
|
Role callerRole = findRole(caller.getRoleId());
|
||||||
|
if (callerRole == null || callerRole.getRoleType() != RoleType.Admin) {
|
||||||
|
throw new PermissionDeniedException("Restricted API called by an user account of non-Admin role type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
File apiCmdFile = PropertiesUtil.findConfigFile(PropertiesUtil.getDefaultApiCommandsFileName());
|
||||||
|
return RoleService.EnableDynamicApiChecker.value() && (apiCmdFile == null || !apiCmdFile.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Role findRole(final Long id) {
|
||||||
|
if (id == null || id < 1L) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return roleDao.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RolePermission findRolePermission(final Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return rolePermissionsDao.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RolePermission findRolePermissionByUuid(final String uuid) {
|
||||||
|
if (Strings.isNullOrEmpty(uuid)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return rolePermissionsDao.findByUuid(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_CREATE, eventDescription = "creating Role")
|
||||||
|
public Role createRole(final String name, final RoleType roleType, final String description) {
|
||||||
|
checkCallerAccess();
|
||||||
|
if (roleType == null || roleType == RoleType.Unknown) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role type provided");
|
||||||
|
}
|
||||||
|
return Transaction.execute(new TransactionCallback<RoleVO>() {
|
||||||
|
@Override
|
||||||
|
public RoleVO doInTransaction(TransactionStatus status) {
|
||||||
|
return roleDao.persist(new RoleVO(name, roleType, description));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_UPDATE, eventDescription = "updating Role")
|
||||||
|
public boolean updateRole(final Role role, final String name, final RoleType roleType, final String description) {
|
||||||
|
checkCallerAccess();
|
||||||
|
if (role == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (roleType != null && roleType == RoleType.Unknown) {
|
||||||
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unknown is not a valid role type");
|
||||||
|
}
|
||||||
|
RoleVO roleVO = (RoleVO) role;
|
||||||
|
if (!Strings.isNullOrEmpty(name)) {
|
||||||
|
roleVO.setName(name);
|
||||||
|
}
|
||||||
|
if (roleType != null) {
|
||||||
|
if (role.getId() <= RoleType.User.getId()) {
|
||||||
|
throw new PermissionDeniedException("The role type of default roles cannot be changed");
|
||||||
|
}
|
||||||
|
List<? extends Account> accounts = accountDao.findAccountsByRole(role.getId());
|
||||||
|
if (accounts == null || accounts.isEmpty()) {
|
||||||
|
roleVO.setRoleType(roleType);
|
||||||
|
} else {
|
||||||
|
throw new PermissionDeniedException("Found accounts that have role in use, won't allow to change role type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Strings.isNullOrEmpty(description)) {
|
||||||
|
roleVO.setDescription(description);
|
||||||
|
}
|
||||||
|
return roleDao.update(role.getId(), roleVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_DELETE, eventDescription = "deleting Role")
|
||||||
|
public boolean deleteRole(final Role role) {
|
||||||
|
checkCallerAccess();
|
||||||
|
if (role == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (role.getId() <= RoleType.User.getId()) {
|
||||||
|
throw new PermissionDeniedException("Default roles cannot be deleted");
|
||||||
|
}
|
||||||
|
List<? extends Account> accounts = accountDao.findAccountsByRole(role.getId());
|
||||||
|
if (accounts == null || accounts.size() == 0) {
|
||||||
|
return Transaction.execute(new TransactionCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean doInTransaction(TransactionStatus status) {
|
||||||
|
List<? extends RolePermission> rolePermissions = rolePermissionsDao.findAllByRoleIdSorted(role.getId());
|
||||||
|
if (rolePermissions != null && !rolePermissions.isEmpty()) {
|
||||||
|
for (RolePermission rolePermission : rolePermissions) {
|
||||||
|
rolePermissionsDao.remove(rolePermission.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return roleDao.remove(role.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
throw new PermissionDeniedException("Found accounts that have role in use, won't allow to delete role");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_CREATE, eventDescription = "creating Role Permission")
|
||||||
|
public RolePermission createRolePermission(final Role role, final Rule rule, final RolePermission.Permission permission, final String description) {
|
||||||
|
checkCallerAccess();
|
||||||
|
return Transaction.execute(new TransactionCallback<RolePermissionVO>() {
|
||||||
|
@Override
|
||||||
|
public RolePermissionVO doInTransaction(TransactionStatus status) {
|
||||||
|
return rolePermissionsDao.persist(new RolePermissionVO(role.getId(), rule.toString(), permission, description));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_UPDATE, eventDescription = "updating Role Permission order")
|
||||||
|
public boolean updateRolePermission(final Role role, final List<RolePermission> newOrder) {
|
||||||
|
checkCallerAccess();
|
||||||
|
return role != null && newOrder != null && rolePermissionsDao.update(role, newOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_DELETE, eventDescription = "deleting Role Permission")
|
||||||
|
public boolean deleteRolePermission(final RolePermission rolePermission) {
|
||||||
|
checkCallerAccess();
|
||||||
|
return rolePermission != null && rolePermissionsDao.remove(rolePermission.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> findRolesByName(final String name) {
|
||||||
|
List<? extends Role> roles = null;
|
||||||
|
if (!Strings.isNullOrEmpty(name)) {
|
||||||
|
roles = roleDao.findAllByName(name);
|
||||||
|
}
|
||||||
|
return ListUtils.toListOfInterface(roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> findRolesByType(final RoleType roleType) {
|
||||||
|
List<? extends Role> roles = null;
|
||||||
|
if (roleType != null) {
|
||||||
|
roles = roleDao.findAllByRoleType(roleType);
|
||||||
|
}
|
||||||
|
return ListUtils.toListOfInterface(roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> listRoles() {
|
||||||
|
List<? extends Role> roles = roleDao.listAll();
|
||||||
|
return ListUtils.toListOfInterface(roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RolePermission> findAllPermissionsBy(final Long roleId) {
|
||||||
|
List<? extends RolePermission> permissions = rolePermissionsDao.findAllByRoleIdSorted(roleId);
|
||||||
|
if (permissions != null) {
|
||||||
|
return new ArrayList<>(permissions);
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getConfigComponentName() {
|
||||||
|
return RoleService.class.getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConfigKey<?>[] getConfigKeys() {
|
||||||
|
return new ConfigKey<?>[]{RoleService.EnableDynamicApiChecker};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Class<?>> getCommands() {
|
||||||
|
final List<Class<?>> cmdList = new ArrayList<>();
|
||||||
|
cmdList.add(CreateRoleCmd.class);
|
||||||
|
cmdList.add(ListRolesCmd.class);
|
||||||
|
cmdList.add(UpdateRoleCmd.class);
|
||||||
|
cmdList.add(DeleteRoleCmd.class);
|
||||||
|
cmdList.add(CreateRolePermissionCmd.class);
|
||||||
|
cmdList.add(ListRolePermissionsCmd.class);
|
||||||
|
cmdList.add(UpdateRolePermissionCmd.class);
|
||||||
|
cmdList.add(DeleteRolePermissionCmd.class);
|
||||||
|
return cmdList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -328,13 +328,13 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager, Acco
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
|
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
|
||||||
short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
|
short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
|
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId,
|
||||||
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
|
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
@ -366,7 +366,7 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager, Acco
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
|
public Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,7 +196,7 @@ public class RoleBasedAPIAccessChecker extends AdapterBase implements APIChecker
|
|||||||
try {
|
try {
|
||||||
short cmdPermissions = Short.parseShort(roleMask);
|
short cmdPermissions = Short.parseShort(roleMask);
|
||||||
for (RoleType roleType : RoleType.values()) {
|
for (RoleType roleType : RoleType.values()) {
|
||||||
if ((cmdPermissions & roleType.getValue()) != 0)
|
if ((cmdPermissions & roleType.getMask()) != 0)
|
||||||
commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
|
commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
|
|||||||
902
setup/db/db/create-default-role-api-mappings.sql
Normal file
902
setup/db/db/create-default-role-api-mappings.sql
Normal file
@ -0,0 +1,902 @@
|
|||||||
|
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
-- or more contributor license agreements. See the NOTICE file
|
||||||
|
-- distributed with this work for additional information
|
||||||
|
-- regarding copyright ownership. The ASF licenses this file
|
||||||
|
-- to you under the Apache License, Version 2.0 (the
|
||||||
|
-- "License"); you may not use this file except in compliance
|
||||||
|
-- with the License. You may obtain a copy of the License at
|
||||||
|
--
|
||||||
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
--
|
||||||
|
-- Unless required by applicable law or agreed to in writing,
|
||||||
|
-- software distributed under the License is distributed on an
|
||||||
|
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
-- KIND, either express or implied. See the License for the
|
||||||
|
-- specific language governing permissions and limitations
|
||||||
|
-- under the License.
|
||||||
|
|
||||||
|
-- The default admin role (id:1) will be allowed all APIs so need to insert rules for admin role
|
||||||
|
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
|
||||||
|
-- Insert default role-api mappings for rest of the default roles: resourceadmin(id:2), domainadmin(id:3), user(id:4)
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'activateProject', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addAccountToProject', 'ALLOW', 1) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addHost', 'ALLOW', 2) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addIpToNic', 'ALLOW', 3) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addLdapConfiguration', 'ALLOW', 4) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addNicToVirtualMachine', 'ALLOW', 5) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addVpnUser', 'ALLOW', 6) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'archiveEvents', 'ALLOW', 7) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignCertToLoadBalancer', 'ALLOW', 8) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignToGlobalLoadBalancerRule', 'ALLOW', 9) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignToLoadBalancerRule', 'ALLOW', 10) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignVirtualMachine', 'ALLOW', 11) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'associateIpAddress', 'ALLOW', 12) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'associateLun', 'ALLOW', 13) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'attachIso', 'ALLOW', 14) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'attachVolume', 'ALLOW', 15) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSamlSso', 'ALLOW', 16) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSecurityGroupEgress', 'ALLOW', 17) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSecurityGroupIngress', 'ALLOW', 18) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'changeServiceForRouter', 'ALLOW', 19) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'changeServiceForVirtualMachine', 'ALLOW', 20) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureInternalLoadBalancerElement', 'ALLOW', 21) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureOvsElement', 'ALLOW', 22) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureVirtualRouterElement', 'ALLOW', 23) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'copyIso', 'ALLOW', 24) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'copyTemplate', 'ALLOW', 25) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAccount', 'ALLOW', 26) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAffinityGroup', 'ALLOW', 27) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScalePolicy', 'ALLOW', 28) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScaleVmGroup', 'ALLOW', 29) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScaleVmProfile', 'ALLOW', 30) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createCondition', 'ALLOW', 31) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createDiskOffering', 'ALLOW', 32) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createEgressFirewallRule', 'ALLOW', 33) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createFirewallRule', 'ALLOW', 34) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createGlobalLoadBalancerRule', 'ALLOW', 35) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createInstanceGroup', 'ALLOW', 36) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createInternalLoadBalancerElement', 'ALLOW', 37) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createIpForwardingRule', 'ALLOW', 38) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLBHealthCheckPolicy', 'ALLOW', 39) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLBStickinessPolicy', 'ALLOW', 40) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLoadBalancer', 'ALLOW', 41) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLoadBalancerRule', 'ALLOW', 42) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLunOnFiler', 'ALLOW', 43) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetwork', 'ALLOW', 44) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetworkACL', 'ALLOW', 45) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetworkACLList', 'ALLOW', 46) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createOvsElement', 'ALLOW', 47) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createPool', 'ALLOW', 48) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createPortForwardingRule', 'ALLOW', 49) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createProject', 'ALLOW', 50) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createRemoteAccessVpn', 'ALLOW', 51) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSSHKeyPair', 'ALLOW', 52) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSecurityGroup', 'ALLOW', 53) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createServiceOffering', 'ALLOW', 54) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSnapshot', 'ALLOW', 55) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSnapshotPolicy', 'ALLOW', 56) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createStaticRoute', 'ALLOW', 57) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createTags', 'ALLOW', 58) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createTemplate', 'ALLOW', 59) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createUser', 'ALLOW', 60) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVMSnapshot', 'ALLOW', 61) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVPC', 'ALLOW', 62) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVirtualRouterElement', 'ALLOW', 63) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVolume', 'ALLOW', 64) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVolumeOnFiler', 'ALLOW', 65) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnConnection', 'ALLOW', 66) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnCustomerGateway', 'ALLOW', 67) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnGateway', 'ALLOW', 68) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccount', 'ALLOW', 69) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccountFromProject', 'ALLOW', 70) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAffinityGroup', 'ALLOW', 71) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScalePolicy', 'ALLOW', 72) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScaleVmGroup', 'ALLOW', 73) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScaleVmProfile', 'ALLOW', 74) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteCondition', 'ALLOW', 75) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteDiskOffering', 'ALLOW', 76) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteEgressFirewallRule', 'ALLOW', 77) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteEvents', 'ALLOW', 78) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteFirewallRule', 'ALLOW', 79) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteGlobalLoadBalancerRule', 'ALLOW', 80) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteHost', 'ALLOW', 81) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteInstanceGroup', 'ALLOW', 82) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteIpForwardingRule', 'ALLOW', 83) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteIso', 'ALLOW', 84) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLBHealthCheckPolicy', 'ALLOW', 85) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLBStickinessPolicy', 'ALLOW', 86) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLdapConfiguration', 'ALLOW', 87) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLoadBalancer', 'ALLOW', 88) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLoadBalancerRule', 'ALLOW', 89) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetwork', 'ALLOW', 90) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetworkACL', 'ALLOW', 91) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetworkACLList', 'ALLOW', 92) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deletePool', 'ALLOW', 93) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deletePortForwardingRule', 'ALLOW', 94) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteProject', 'ALLOW', 95) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteProjectInvitation', 'ALLOW', 96) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteRemoteAccessVpn', 'ALLOW', 97) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSSHKeyPair', 'ALLOW', 98) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSecurityGroup', 'ALLOW', 99) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteServiceOffering', 'ALLOW', 100) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSnapshot', 'ALLOW', 101) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSnapshotPolicies', 'ALLOW', 102) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSslCert', 'ALLOW', 103) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteStaticRoute', 'ALLOW', 104) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteTags', 'ALLOW', 105) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteTemplate', 'ALLOW', 106) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteUser', 'ALLOW', 107) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVMSnapshot', 'ALLOW', 108) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVPC', 'ALLOW', 109) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVolume', 'ALLOW', 110) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnConnection', 'ALLOW', 111) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnCustomerGateway', 'ALLOW', 112) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnGateway', 'ALLOW', 113) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deployVirtualMachine', 'ALLOW', 114) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyLunOnFiler', 'ALLOW', 115) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyRouter', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyVirtualMachine', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyVolumeOnFiler', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'detachIso', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'detachVolume', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableAccount', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableAutoScaleVmGroup', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableStaticNat', 'ALLOW', 123) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableUser', 'ALLOW', 124) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disassociateIpAddress', 'ALLOW', 125) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'dissociateLun', 'ALLOW', 126) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableAccount', 'ALLOW', 127) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableAutoScaleVmGroup', 'ALLOW', 128) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableStaticNat', 'ALLOW', 129) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableUser', 'ALLOW', 130) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'expungeVirtualMachine', 'ALLOW', 131) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractIso', 'ALLOW', 132) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractTemplate', 'ALLOW', 133) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractVolume', 'ALLOW', 134) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getApiLimit', 'ALLOW', 135) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getCloudIdentifier', 'ALLOW', 136) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireAccountId', 'ALLOW', 137) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeAccessGroupId', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeIscsiName', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeSize', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getUploadParamsForTemplate', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getUploadParamsForVolume', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVMPassword', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVirtualMachineUserData', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'importLdapUsers', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'issueNuageVspResourceRequest', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'ldapCreateAccount', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'linkDomainToLdap', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAccounts', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAffinityGroupTypes', 'ALLOW', 150) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAffinityGroups', 'ALLOW', 151) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAlerts', 'ALLOW', 152) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listApis', 'ALLOW', 153) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAsyncJobs', 'ALLOW', 154) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScalePolicies', 'ALLOW', 155) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScaleVmGroups', 'ALLOW', 156) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScaleVmProfiles', 'ALLOW', 157) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCapabilities', 'ALLOW', 158) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCapacity', 'ALLOW', 159) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listClusters', 'ALLOW', 160) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listConditions', 'ALLOW', 161) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCounters', 'ALLOW', 162) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDiskOfferings', 'ALLOW', 163) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDomainChildren', 'ALLOW', 164) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDomains', 'ALLOW', 165) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEgressFirewallRules', 'ALLOW', 166) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEventTypes', 'ALLOW', 167) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEvents', 'ALLOW', 168) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listFirewallRules', 'ALLOW', 169) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listGlobalLoadBalancerRules', 'ALLOW', 170) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHostTags', 'ALLOW', 171) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHosts', 'ALLOW', 172) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHypervisors', 'ALLOW', 173) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listInstanceGroups', 'ALLOW', 174) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listInternalLoadBalancerElements', 'ALLOW', 175) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIpForwardingRules', 'ALLOW', 176) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIsoPermissions', 'ALLOW', 177) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIsos', 'ALLOW', 178) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLBHealthCheckPolicies', 'ALLOW', 179) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLBStickinessPolicies', 'ALLOW', 180) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLdapConfigurations', 'ALLOW', 181) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLdapUsers', 'ALLOW', 182) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancerRuleInstances', 'ALLOW', 183) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancerRules', 'ALLOW', 184) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancers', 'ALLOW', 185) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLunsOnFiler', 'ALLOW', 186) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkACLLists', 'ALLOW', 187) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkACLs', 'ALLOW', 188) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkOfferings', 'ALLOW', 189) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworks', 'ALLOW', 190) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNics', 'ALLOW', 191) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOsCategories', 'ALLOW', 192) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOsTypes', 'ALLOW', 193) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOvsElements', 'ALLOW', 194) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPods', 'ALLOW', 195) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPools', 'ALLOW', 196) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPortForwardingRules', 'ALLOW', 197) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPrivateGateways', 'ALLOW', 198) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjectAccounts', 'ALLOW', 199) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjectInvitations', 'ALLOW', 200) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjects', 'ALLOW', 201) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPublicIpAddresses', 'ALLOW', 202) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRegions', 'ALLOW', 203) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRemoteAccessVpns', 'ALLOW', 204) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listResourceDetails', 'ALLOW', 205) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listResourceLimits', 'ALLOW', 206) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRouters', 'ALLOW', 207) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSSHKeyPairs', 'ALLOW', 208) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSamlAuthorization', 'ALLOW', 209) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSecurityGroups', 'ALLOW', 210) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listServiceOfferings', 'ALLOW', 211) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSnapshotPolicies', 'ALLOW', 212) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSnapshots', 'ALLOW', 213) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSslCerts', 'ALLOW', 214) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStaticRoutes', 'ALLOW', 215) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStoragePools', 'ALLOW', 216) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStorageProviders', 'ALLOW', 217) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStorageTags', 'ALLOW', 218) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSystemVms', 'ALLOW', 219) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTags', 'ALLOW', 220) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTemplatePermissions', 'ALLOW', 221) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTemplates', 'ALLOW', 222) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listUsageRecords', 'ALLOW', 223) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listUsers', 'ALLOW', 224) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVMSnapshot', 'ALLOW', 225) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVPCOfferings', 'ALLOW', 226) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVPCs', 'ALLOW', 227) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVirtualMachines', 'ALLOW', 228) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVirtualRouterElements', 'ALLOW', 229) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVolumes', 'ALLOW', 230) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVolumesOnFiler', 'ALLOW', 231) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnConnections', 'ALLOW', 232) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnCustomerGateways', 'ALLOW', 233) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnGateways', 'ALLOW', 234) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnUsers', 'ALLOW', 235) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listZones', 'ALLOW', 236) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'lockAccount', 'ALLOW', 237) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'lockUser', 'ALLOW', 238) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'migrateVolume', 'ALLOW', 239) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'modifyPool', 'ALLOW', 240) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'queryAsyncJobResult', 'ALLOW', 241) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaBalance', 'ALLOW', 242) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaIsEnabled', 'ALLOW', 243) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaStatement', 'ALLOW', 244) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaSummary', 'ALLOW', 245) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaTariffList', 'ALLOW', 246) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'rebootRouter', 'ALLOW', 247) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'rebootVirtualMachine', 'ALLOW', 248) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'recoverVirtualMachine', 'ALLOW', 249) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerIso', 'ALLOW', 250) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerSSHKeyPair', 'ALLOW', 251) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerTemplate', 'ALLOW', 252) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerUserKeys', 'ALLOW', 253) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeCertFromLoadBalancer', 'ALLOW', 254) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeFromGlobalLoadBalancerRule', 'ALLOW', 255) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeFromLoadBalancerRule', 'ALLOW', 256) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeIpFromNic', 'ALLOW', 257) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeNicFromVirtualMachine', 'ALLOW', 258) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeVpnUser', 'ALLOW', 259) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'replaceNetworkACLList', 'ALLOW', 260) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetPasswordForVirtualMachine', 'ALLOW', 261) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetSSHKeyForVirtualMachine', 'ALLOW', 262) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetVpnConnection', 'ALLOW', 263) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resizeVolume', 'ALLOW', 264) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restartNetwork', 'ALLOW', 265) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restartVPC', 'ALLOW', 266) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restoreVirtualMachine', 'ALLOW', 267) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revertSnapshot', 'ALLOW', 268) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revertToVMSnapshot', 'ALLOW', 269) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revokeSecurityGroupEgress', 'ALLOW', 270) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revokeSecurityGroupIngress', 'ALLOW', 271) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'scaleVirtualMachine', 'ALLOW', 272) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'startRouter', 'ALLOW', 273) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'startVirtualMachine', 'ALLOW', 274) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'stopRouter', 'ALLOW', 275) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'stopVirtualMachine', 'ALLOW', 276) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'suspendProject', 'ALLOW', 277) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAccount', 'ALLOW', 278) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScalePolicy', 'ALLOW', 279) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScaleVmGroup', 'ALLOW', 280) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScaleVmProfile', 'ALLOW', 281) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateDefaultNicForVirtualMachine', 'ALLOW', 282) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateDiskOffering', 'ALLOW', 283) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateEgressFirewallRule', 'ALLOW', 284) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateFirewallRule', 'ALLOW', 285) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateGlobalLoadBalancerRule', 'ALLOW', 286) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateInstanceGroup', 'ALLOW', 287) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIpAddress', 'ALLOW', 288) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIso', 'ALLOW', 289) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIsoPermissions', 'ALLOW', 290) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLBHealthCheckPolicy', 'ALLOW', 291) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLBStickinessPolicy', 'ALLOW', 292) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLoadBalancer', 'ALLOW', 293) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLoadBalancerRule', 'ALLOW', 294) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetwork', 'ALLOW', 295) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetworkACLItem', 'ALLOW', 296) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetworkACLList', 'ALLOW', 297) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updatePortForwardingRule', 'ALLOW', 298) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateProject', 'ALLOW', 299) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateProjectInvitation', 'ALLOW', 300) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateRemoteAccessVpn', 'ALLOW', 301) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateResourceCount', 'ALLOW', 302) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateResourceLimit', 'ALLOW', 303) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateServiceOffering', 'ALLOW', 304) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateSnapshotPolicy', 'ALLOW', 305) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateTemplate', 'ALLOW', 306) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateTemplatePermissions', 'ALLOW', 307) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateUser', 'ALLOW', 308) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVMAffinityGroup', 'ALLOW', 309) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVPC', 'ALLOW', 310) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVirtualMachine', 'ALLOW', 311) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVmNicIp', 'ALLOW', 312) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnConnection', 'ALLOW', 313) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnCustomerGateway', 'ALLOW', 314) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnGateway', 'ALLOW', 315) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'uploadSslCert', 'ALLOW', 316) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'uploadVolume', 'ALLOW', 317) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'activateProject', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addAccountToProject', 'ALLOW', 1) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addIpToNic', 'ALLOW', 2) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addNicToVirtualMachine', 'ALLOW', 3) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addVpnUser', 'ALLOW', 4) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'archiveEvents', 'ALLOW', 5) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignCertToLoadBalancer', 'ALLOW', 6) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignToGlobalLoadBalancerRule', 'ALLOW', 7) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignToLoadBalancerRule', 'ALLOW', 8) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignVirtualMachine', 'ALLOW', 9) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'associateIpAddress', 'ALLOW', 10) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'associateLun', 'ALLOW', 11) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'attachIso', 'ALLOW', 12) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'attachVolume', 'ALLOW', 13) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSamlSso', 'ALLOW', 14) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSecurityGroupEgress', 'ALLOW', 15) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSecurityGroupIngress', 'ALLOW', 16) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'changeServiceForRouter', 'ALLOW', 17) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'changeServiceForVirtualMachine', 'ALLOW', 18) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureInternalLoadBalancerElement', 'ALLOW', 19) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureOvsElement', 'ALLOW', 20) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureVirtualRouterElement', 'ALLOW', 21) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'copyIso', 'ALLOW', 22) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'copyTemplate', 'ALLOW', 23) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAccount', 'ALLOW', 24) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAffinityGroup', 'ALLOW', 25) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScalePolicy', 'ALLOW', 26) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScaleVmGroup', 'ALLOW', 27) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScaleVmProfile', 'ALLOW', 28) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createCondition', 'ALLOW', 29) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createDiskOffering', 'ALLOW', 30) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createEgressFirewallRule', 'ALLOW', 31) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createFirewallRule', 'ALLOW', 32) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createGlobalLoadBalancerRule', 'ALLOW', 33) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createInstanceGroup', 'ALLOW', 34) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createInternalLoadBalancerElement', 'ALLOW', 35) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createIpForwardingRule', 'ALLOW', 36) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLBHealthCheckPolicy', 'ALLOW', 37) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLBStickinessPolicy', 'ALLOW', 38) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLoadBalancer', 'ALLOW', 39) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLoadBalancerRule', 'ALLOW', 40) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLunOnFiler', 'ALLOW', 41) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetwork', 'ALLOW', 42) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetworkACL', 'ALLOW', 43) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetworkACLList', 'ALLOW', 44) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createOvsElement', 'ALLOW', 45) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createPool', 'ALLOW', 46) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createPortForwardingRule', 'ALLOW', 47) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createProject', 'ALLOW', 48) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createRemoteAccessVpn', 'ALLOW', 49) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSSHKeyPair', 'ALLOW', 50) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSecurityGroup', 'ALLOW', 51) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createServiceOffering', 'ALLOW', 52) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSnapshot', 'ALLOW', 53) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSnapshotPolicy', 'ALLOW', 54) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createStaticRoute', 'ALLOW', 55) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createTags', 'ALLOW', 56) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createTemplate', 'ALLOW', 57) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createUser', 'ALLOW', 58) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVMSnapshot', 'ALLOW', 59) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVPC', 'ALLOW', 60) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVirtualRouterElement', 'ALLOW', 61) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVolume', 'ALLOW', 62) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVolumeOnFiler', 'ALLOW', 63) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnConnection', 'ALLOW', 64) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnCustomerGateway', 'ALLOW', 65) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnGateway', 'ALLOW', 66) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAccount', 'ALLOW', 67) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAccountFromProject', 'ALLOW', 68) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAffinityGroup', 'ALLOW', 69) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScalePolicy', 'ALLOW', 70) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScaleVmGroup', 'ALLOW', 71) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScaleVmProfile', 'ALLOW', 72) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteCondition', 'ALLOW', 73) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteDiskOffering', 'ALLOW', 74) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteEgressFirewallRule', 'ALLOW', 75) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteEvents', 'ALLOW', 76) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteFirewallRule', 'ALLOW', 77) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteGlobalLoadBalancerRule', 'ALLOW', 78) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteInstanceGroup', 'ALLOW', 79) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteIpForwardingRule', 'ALLOW', 80) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteIso', 'ALLOW', 81) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLBHealthCheckPolicy', 'ALLOW', 82) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLBStickinessPolicy', 'ALLOW', 83) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLoadBalancer', 'ALLOW', 84) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLoadBalancerRule', 'ALLOW', 85) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetwork', 'ALLOW', 86) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetworkACL', 'ALLOW', 87) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetworkACLList', 'ALLOW', 88) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deletePool', 'ALLOW', 89) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deletePortForwardingRule', 'ALLOW', 90) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteProject', 'ALLOW', 91) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteProjectInvitation', 'ALLOW', 92) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteRemoteAccessVpn', 'ALLOW', 93) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSSHKeyPair', 'ALLOW', 94) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSecurityGroup', 'ALLOW', 95) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteServiceOffering', 'ALLOW', 96) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSnapshot', 'ALLOW', 97) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSnapshotPolicies', 'ALLOW', 98) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSslCert', 'ALLOW', 99) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteStaticRoute', 'ALLOW', 100) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteTags', 'ALLOW', 101) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteTemplate', 'ALLOW', 102) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteUser', 'ALLOW', 103) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVMSnapshot', 'ALLOW', 104) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVPC', 'ALLOW', 105) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVolume', 'ALLOW', 106) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnConnection', 'ALLOW', 107) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnCustomerGateway', 'ALLOW', 108) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnGateway', 'ALLOW', 109) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deployVirtualMachine', 'ALLOW', 110) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyLunOnFiler', 'ALLOW', 111) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyRouter', 'ALLOW', 112) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyVirtualMachine', 'ALLOW', 113) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyVolumeOnFiler', 'ALLOW', 114) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'detachIso', 'ALLOW', 115) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'detachVolume', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableAccount', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableAutoScaleVmGroup', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableStaticNat', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableUser', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disassociateIpAddress', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'dissociateLun', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableAccount', 'ALLOW', 123) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableAutoScaleVmGroup', 'ALLOW', 124) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableStaticNat', 'ALLOW', 125) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableUser', 'ALLOW', 126) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'expungeVirtualMachine', 'ALLOW', 127) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractIso', 'ALLOW', 128) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractTemplate', 'ALLOW', 129) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractVolume', 'ALLOW', 130) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getApiLimit', 'ALLOW', 131) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getCloudIdentifier', 'ALLOW', 132) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireAccountId', 'ALLOW', 133) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeAccessGroupId', 'ALLOW', 134) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeIscsiName', 'ALLOW', 135) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeSize', 'ALLOW', 136) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getUploadParamsForTemplate', 'ALLOW', 137) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getUploadParamsForVolume', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVMPassword', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVirtualMachineUserData', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'issueNuageVspResourceRequest', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAccounts', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroupTypes', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroups', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listApis', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAsyncJobs', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScalePolicies', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScaleVmGroups', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScaleVmProfiles', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listCapabilities', 'ALLOW', 150) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listConditions', 'ALLOW', 151) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listCounters', 'ALLOW', 152) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDiskOfferings', 'ALLOW', 153) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDomainChildren', 'ALLOW', 154) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDomains', 'ALLOW', 155) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listEgressFirewallRules', 'ALLOW', 156) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listEventTypes', 'ALLOW', 157) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listEvents', 'ALLOW', 158) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listFirewallRules', 'ALLOW', 159) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listGlobalLoadBalancerRules', 'ALLOW', 160) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listHostTags', 'ALLOW', 161) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listHypervisors', 'ALLOW', 162) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listInstanceGroups', 'ALLOW', 163) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listInternalLoadBalancerElements', 'ALLOW', 164) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listIpForwardingRules', 'ALLOW', 165) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listIsoPermissions', 'ALLOW', 166) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listIsos', 'ALLOW', 167) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLBHealthCheckPolicies', 'ALLOW', 168) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLBStickinessPolicies', 'ALLOW', 169) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLdapConfigurations', 'ALLOW', 170) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLoadBalancerRuleInstances', 'ALLOW', 171) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLoadBalancerRules', 'ALLOW', 172) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLoadBalancers', 'ALLOW', 173) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listLunsOnFiler', 'ALLOW', 174) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listNetworkACLLists', 'ALLOW', 175) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listNetworkACLs', 'ALLOW', 176) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listNetworkOfferings', 'ALLOW', 177) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listNetworks', 'ALLOW', 178) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listNics', 'ALLOW', 179) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listOsCategories', 'ALLOW', 180) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listOsTypes', 'ALLOW', 181) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listOvsElements', 'ALLOW', 182) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listPools', 'ALLOW', 183) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listPortForwardingRules', 'ALLOW', 184) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listPrivateGateways', 'ALLOW', 185) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listProjectAccounts', 'ALLOW', 186) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listProjectInvitations', 'ALLOW', 187) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listProjects', 'ALLOW', 188) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listPublicIpAddresses', 'ALLOW', 189) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listRegions', 'ALLOW', 190) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listRemoteAccessVpns', 'ALLOW', 191) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listResourceDetails', 'ALLOW', 192) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listResourceLimits', 'ALLOW', 193) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listRouters', 'ALLOW', 194) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSSHKeyPairs', 'ALLOW', 195) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSamlAuthorization', 'ALLOW', 196) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSecurityGroups', 'ALLOW', 197) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listServiceOfferings', 'ALLOW', 198) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSnapshotPolicies', 'ALLOW', 199) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSnapshots', 'ALLOW', 200) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listSslCerts', 'ALLOW', 201) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listStaticRoutes', 'ALLOW', 202) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listStorageTags', 'ALLOW', 203) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listTags', 'ALLOW', 204) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listTemplatePermissions', 'ALLOW', 205) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listTemplates', 'ALLOW', 206) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listUsageRecords', 'ALLOW', 207) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listUsers', 'ALLOW', 208) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVMSnapshot', 'ALLOW', 209) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVPCOfferings', 'ALLOW', 210) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVPCs', 'ALLOW', 211) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVirtualMachines', 'ALLOW', 212) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVirtualRouterElements', 'ALLOW', 213) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVolumes', 'ALLOW', 214) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVolumesOnFiler', 'ALLOW', 215) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVpnConnections', 'ALLOW', 216) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVpnCustomerGateways', 'ALLOW', 217) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVpnGateways', 'ALLOW', 218) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listVpnUsers', 'ALLOW', 219) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listZones', 'ALLOW', 220) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'lockAccount', 'ALLOW', 221) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'lockUser', 'ALLOW', 222) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'migrateVolume', 'ALLOW', 223) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'modifyPool', 'ALLOW', 224) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'queryAsyncJobResult', 'ALLOW', 225) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'quotaBalance', 'ALLOW', 226) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'quotaIsEnabled', 'ALLOW', 227) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'quotaStatement', 'ALLOW', 228) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'quotaSummary', 'ALLOW', 229) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'quotaTariffList', 'ALLOW', 230) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'rebootRouter', 'ALLOW', 231) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'rebootVirtualMachine', 'ALLOW', 232) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'recoverVirtualMachine', 'ALLOW', 233) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'registerIso', 'ALLOW', 234) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'registerSSHKeyPair', 'ALLOW', 235) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'registerTemplate', 'ALLOW', 236) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'registerUserKeys', 'ALLOW', 237) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeCertFromLoadBalancer', 'ALLOW', 238) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeFromGlobalLoadBalancerRule', 'ALLOW', 239) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeFromLoadBalancerRule', 'ALLOW', 240) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeIpFromNic', 'ALLOW', 241) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeNicFromVirtualMachine', 'ALLOW', 242) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'removeVpnUser', 'ALLOW', 243) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'replaceNetworkACLList', 'ALLOW', 244) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'resetPasswordForVirtualMachine', 'ALLOW', 245) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'resetSSHKeyForVirtualMachine', 'ALLOW', 246) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'resetVpnConnection', 'ALLOW', 247) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'resizeVolume', 'ALLOW', 248) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'restartNetwork', 'ALLOW', 249) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'restartVPC', 'ALLOW', 250) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'restoreVirtualMachine', 'ALLOW', 251) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'revertSnapshot', 'ALLOW', 252) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'revertToVMSnapshot', 'ALLOW', 253) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'revokeSecurityGroupEgress', 'ALLOW', 254) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'revokeSecurityGroupIngress', 'ALLOW', 255) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'scaleVirtualMachine', 'ALLOW', 256) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'startRouter', 'ALLOW', 257) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'startVirtualMachine', 'ALLOW', 258) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'stopRouter', 'ALLOW', 259) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'stopVirtualMachine', 'ALLOW', 260) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'suspendProject', 'ALLOW', 261) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateAccount', 'ALLOW', 262) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateAutoScalePolicy', 'ALLOW', 263) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateAutoScaleVmGroup', 'ALLOW', 264) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateAutoScaleVmProfile', 'ALLOW', 265) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateDefaultNicForVirtualMachine', 'ALLOW', 266) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateDiskOffering', 'ALLOW', 267) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateEgressFirewallRule', 'ALLOW', 268) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateFirewallRule', 'ALLOW', 269) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateGlobalLoadBalancerRule', 'ALLOW', 270) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateInstanceGroup', 'ALLOW', 271) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateIpAddress', 'ALLOW', 272) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateIso', 'ALLOW', 273) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateIsoPermissions', 'ALLOW', 274) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateLBHealthCheckPolicy', 'ALLOW', 275) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateLBStickinessPolicy', 'ALLOW', 276) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateLoadBalancer', 'ALLOW', 277) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateLoadBalancerRule', 'ALLOW', 278) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateNetwork', 'ALLOW', 279) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateNetworkACLItem', 'ALLOW', 280) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateNetworkACLList', 'ALLOW', 281) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updatePortForwardingRule', 'ALLOW', 282) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateProject', 'ALLOW', 283) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateProjectInvitation', 'ALLOW', 284) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateRemoteAccessVpn', 'ALLOW', 285) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateResourceCount', 'ALLOW', 286) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateResourceLimit', 'ALLOW', 287) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateServiceOffering', 'ALLOW', 288) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateSnapshotPolicy', 'ALLOW', 289) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateTemplate', 'ALLOW', 290) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateTemplatePermissions', 'ALLOW', 291) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateUser', 'ALLOW', 292) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVMAffinityGroup', 'ALLOW', 293) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVPC', 'ALLOW', 294) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVirtualMachine', 'ALLOW', 295) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVmNicIp', 'ALLOW', 296) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVpnConnection', 'ALLOW', 297) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVpnCustomerGateway', 'ALLOW', 298) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'updateVpnGateway', 'ALLOW', 299) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'uploadSslCert', 'ALLOW', 300) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'uploadVolume', 'ALLOW', 301) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'activateProject', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'addAccountToProject', 'ALLOW', 1) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'addIpToNic', 'ALLOW', 2) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'addNicToVirtualMachine', 'ALLOW', 3) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'addVpnUser', 'ALLOW', 4) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'archiveEvents', 'ALLOW', 5) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'assignCertToLoadBalancer', 'ALLOW', 6) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'assignToGlobalLoadBalancerRule', 'ALLOW', 7) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'assignToLoadBalancerRule', 'ALLOW', 8) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'associateIpAddress', 'ALLOW', 9) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'associateLun', 'ALLOW', 10) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'attachIso', 'ALLOW', 11) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'attachVolume', 'ALLOW', 12) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'authorizeSecurityGroupEgress', 'ALLOW', 13) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'authorizeSecurityGroupIngress', 'ALLOW', 14) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'changeServiceForVirtualMachine', 'ALLOW', 15) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'copyIso', 'ALLOW', 16) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'copyTemplate', 'ALLOW', 17) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createAffinityGroup', 'ALLOW', 18) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createAutoScalePolicy', 'ALLOW', 19) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createAutoScaleVmGroup', 'ALLOW', 20) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createAutoScaleVmProfile', 'ALLOW', 21) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createCondition', 'ALLOW', 22) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createEgressFirewallRule', 'ALLOW', 23) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createFirewallRule', 'ALLOW', 24) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createGlobalLoadBalancerRule', 'ALLOW', 25) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createInstanceGroup', 'ALLOW', 26) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createIpForwardingRule', 'ALLOW', 27) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createLBHealthCheckPolicy', 'ALLOW', 28) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createLBStickinessPolicy', 'ALLOW', 29) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createLoadBalancer', 'ALLOW', 30) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createLoadBalancerRule', 'ALLOW', 31) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createLunOnFiler', 'ALLOW', 32) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createNetwork', 'ALLOW', 33) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createNetworkACL', 'ALLOW', 34) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createNetworkACLList', 'ALLOW', 35) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createPool', 'ALLOW', 36) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createPortForwardingRule', 'ALLOW', 37) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createProject', 'ALLOW', 38) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createRemoteAccessVpn', 'ALLOW', 39) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createSSHKeyPair', 'ALLOW', 40) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createSecurityGroup', 'ALLOW', 41) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createSnapshot', 'ALLOW', 42) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createSnapshotPolicy', 'ALLOW', 43) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createStaticRoute', 'ALLOW', 44) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createTags', 'ALLOW', 45) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createTemplate', 'ALLOW', 46) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVMSnapshot', 'ALLOW', 47) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVPC', 'ALLOW', 48) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVolume', 'ALLOW', 49) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVolumeOnFiler', 'ALLOW', 50) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVpnConnection', 'ALLOW', 51) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVpnCustomerGateway', 'ALLOW', 52) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createVpnGateway', 'ALLOW', 53) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteAccountFromProject', 'ALLOW', 54) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteAffinityGroup', 'ALLOW', 55) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteAutoScalePolicy', 'ALLOW', 56) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteAutoScaleVmGroup', 'ALLOW', 57) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteAutoScaleVmProfile', 'ALLOW', 58) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteCondition', 'ALLOW', 59) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteEgressFirewallRule', 'ALLOW', 60) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteEvents', 'ALLOW', 61) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteFirewallRule', 'ALLOW', 62) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteGlobalLoadBalancerRule', 'ALLOW', 63) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteInstanceGroup', 'ALLOW', 64) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteIpForwardingRule', 'ALLOW', 65) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteIso', 'ALLOW', 66) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteLBHealthCheckPolicy', 'ALLOW', 67) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteLBStickinessPolicy', 'ALLOW', 68) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteLoadBalancer', 'ALLOW', 69) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteLoadBalancerRule', 'ALLOW', 70) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteNetwork', 'ALLOW', 71) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteNetworkACL', 'ALLOW', 72) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteNetworkACLList', 'ALLOW', 73) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deletePool', 'ALLOW', 74) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deletePortForwardingRule', 'ALLOW', 75) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteProject', 'ALLOW', 76) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteProjectInvitation', 'ALLOW', 77) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteRemoteAccessVpn', 'ALLOW', 78) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteSSHKeyPair', 'ALLOW', 79) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteSecurityGroup', 'ALLOW', 80) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteSnapshot', 'ALLOW', 81) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteSnapshotPolicies', 'ALLOW', 82) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteSslCert', 'ALLOW', 83) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteStaticRoute', 'ALLOW', 84) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteTags', 'ALLOW', 85) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteTemplate', 'ALLOW', 86) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVMSnapshot', 'ALLOW', 87) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVPC', 'ALLOW', 88) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVolume', 'ALLOW', 89) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVpnConnection', 'ALLOW', 90) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVpnCustomerGateway', 'ALLOW', 91) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deleteVpnGateway', 'ALLOW', 92) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'deployVirtualMachine', 'ALLOW', 93) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'destroyLunOnFiler', 'ALLOW', 94) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'destroyVirtualMachine', 'ALLOW', 95) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'destroyVolumeOnFiler', 'ALLOW', 96) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'detachIso', 'ALLOW', 97) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'detachVolume', 'ALLOW', 98) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'disableAutoScaleVmGroup', 'ALLOW', 99) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'disableStaticNat', 'ALLOW', 100) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'disassociateIpAddress', 'ALLOW', 101) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'dissociateLun', 'ALLOW', 102) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'enableAutoScaleVmGroup', 'ALLOW', 103) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'enableStaticNat', 'ALLOW', 104) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'expungeVirtualMachine', 'ALLOW', 105) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'extractIso', 'ALLOW', 106) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'extractTemplate', 'ALLOW', 107) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'extractVolume', 'ALLOW', 108) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getApiLimit', 'ALLOW', 109) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getCloudIdentifier', 'ALLOW', 110) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getSolidFireAccountId', 'ALLOW', 111) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getSolidFireVolumeAccessGroupId', 'ALLOW', 112) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getSolidFireVolumeIscsiName', 'ALLOW', 113) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getSolidFireVolumeSize', 'ALLOW', 114) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getUploadParamsForTemplate', 'ALLOW', 115) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getUploadParamsForVolume', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getVMPassword', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getVirtualMachineUserData', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'issueNuageVspResourceRequest', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAccounts', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAffinityGroupTypes', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAffinityGroups', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listApis', 'ALLOW', 123) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAsyncJobs', 'ALLOW', 124) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAutoScalePolicies', 'ALLOW', 125) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAutoScaleVmGroups', 'ALLOW', 126) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAutoScaleVmProfiles', 'ALLOW', 127) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listCapabilities', 'ALLOW', 128) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listConditions', 'ALLOW', 129) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listCounters', 'ALLOW', 130) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listDiskOfferings', 'ALLOW', 131) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listEgressFirewallRules', 'ALLOW', 132) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listEventTypes', 'ALLOW', 133) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listEvents', 'ALLOW', 134) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listFirewallRules', 'ALLOW', 135) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listGlobalLoadBalancerRules', 'ALLOW', 136) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listHypervisors', 'ALLOW', 137) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listInstanceGroups', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listIpForwardingRules', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listIsoPermissions', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listIsos', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLBHealthCheckPolicies', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLBStickinessPolicies', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLdapConfigurations', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLoadBalancerRuleInstances', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLoadBalancerRules', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLoadBalancers', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listLunsOnFiler', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listNetworkACLLists', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listNetworkACLs', 'ALLOW', 150) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listNetworkOfferings', 'ALLOW', 151) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listNetworks', 'ALLOW', 152) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listNics', 'ALLOW', 153) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listOsCategories', 'ALLOW', 154) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listOsTypes', 'ALLOW', 155) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listPools', 'ALLOW', 156) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listPortForwardingRules', 'ALLOW', 157) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listPrivateGateways', 'ALLOW', 158) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listProjectAccounts', 'ALLOW', 159) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listProjectInvitations', 'ALLOW', 160) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listProjects', 'ALLOW', 161) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listPublicIpAddresses', 'ALLOW', 162) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listRegions', 'ALLOW', 163) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listRemoteAccessVpns', 'ALLOW', 164) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listResourceDetails', 'ALLOW', 165) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listResourceLimits', 'ALLOW', 166) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listSSHKeyPairs', 'ALLOW', 167) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listSecurityGroups', 'ALLOW', 168) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listServiceOfferings', 'ALLOW', 169) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listSnapshotPolicies', 'ALLOW', 170) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listSnapshots', 'ALLOW', 171) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listSslCerts', 'ALLOW', 172) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listStaticRoutes', 'ALLOW', 173) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listTags', 'ALLOW', 174) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listTemplatePermissions', 'ALLOW', 175) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listTemplates', 'ALLOW', 176) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listUsers', 'ALLOW', 177) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVMSnapshot', 'ALLOW', 178) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVPCOfferings', 'ALLOW', 179) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVPCs', 'ALLOW', 180) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVirtualMachines', 'ALLOW', 181) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVolumes', 'ALLOW', 182) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVolumesOnFiler', 'ALLOW', 183) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVpnConnections', 'ALLOW', 184) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVpnCustomerGateways', 'ALLOW', 185) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVpnGateways', 'ALLOW', 186) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listVpnUsers', 'ALLOW', 187) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listZones', 'ALLOW', 188) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'migrateVolume', 'ALLOW', 189) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'modifyPool', 'ALLOW', 190) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'queryAsyncJobResult', 'ALLOW', 191) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'quotaBalance', 'ALLOW', 192) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'quotaIsEnabled', 'ALLOW', 193) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'quotaStatement', 'ALLOW', 194) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'quotaSummary', 'ALLOW', 195) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'quotaTariffList', 'ALLOW', 196) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'rebootVirtualMachine', 'ALLOW', 197) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'recoverVirtualMachine', 'ALLOW', 198) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'registerIso', 'ALLOW', 199) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'registerSSHKeyPair', 'ALLOW', 200) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'registerTemplate', 'ALLOW', 201) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'registerUserKeys', 'ALLOW', 202) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeCertFromLoadBalancer', 'ALLOW', 203) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeFromGlobalLoadBalancerRule', 'ALLOW', 204) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeFromLoadBalancerRule', 'ALLOW', 205) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeIpFromNic', 'ALLOW', 206) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeNicFromVirtualMachine', 'ALLOW', 207) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'removeVpnUser', 'ALLOW', 208) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'replaceNetworkACLList', 'ALLOW', 209) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'resetPasswordForVirtualMachine', 'ALLOW', 210) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'resetSSHKeyForVirtualMachine', 'ALLOW', 211) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'resetVpnConnection', 'ALLOW', 212) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'resizeVolume', 'ALLOW', 213) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'restartNetwork', 'ALLOW', 214) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'restartVPC', 'ALLOW', 215) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'restoreVirtualMachine', 'ALLOW', 216) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'revertSnapshot', 'ALLOW', 217) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'revertToVMSnapshot', 'ALLOW', 218) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'revokeSecurityGroupEgress', 'ALLOW', 219) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'revokeSecurityGroupIngress', 'ALLOW', 220) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'scaleVirtualMachine', 'ALLOW', 221) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'startVirtualMachine', 'ALLOW', 222) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'stopVirtualMachine', 'ALLOW', 223) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'suspendProject', 'ALLOW', 224) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateAutoScalePolicy', 'ALLOW', 225) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateAutoScaleVmGroup', 'ALLOW', 226) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateAutoScaleVmProfile', 'ALLOW', 227) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateDefaultNicForVirtualMachine', 'ALLOW', 228) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateEgressFirewallRule', 'ALLOW', 229) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateFirewallRule', 'ALLOW', 230) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateGlobalLoadBalancerRule', 'ALLOW', 231) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateInstanceGroup', 'ALLOW', 232) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateIpAddress', 'ALLOW', 233) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateIso', 'ALLOW', 234) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateIsoPermissions', 'ALLOW', 235) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateLBHealthCheckPolicy', 'ALLOW', 236) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateLBStickinessPolicy', 'ALLOW', 237) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateLoadBalancer', 'ALLOW', 238) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateLoadBalancerRule', 'ALLOW', 239) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateNetwork', 'ALLOW', 240) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateNetworkACLItem', 'ALLOW', 241) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateNetworkACLList', 'ALLOW', 242) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updatePortForwardingRule', 'ALLOW', 243) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateProject', 'ALLOW', 244) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateProjectInvitation', 'ALLOW', 245) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateRemoteAccessVpn', 'ALLOW', 246) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateSnapshotPolicy', 'ALLOW', 247) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateTemplate', 'ALLOW', 248) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateTemplatePermissions', 'ALLOW', 249) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateUser', 'ALLOW', 250) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVMAffinityGroup', 'ALLOW', 251) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVPC', 'ALLOW', 252) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVirtualMachine', 'ALLOW', 253) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVmNicIp', 'ALLOW', 254) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVpnConnection', 'ALLOW', 255) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVpnCustomerGateway', 'ALLOW', 256) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'updateVpnGateway', 'ALLOW', 257) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'uploadSslCert', 'ALLOW', 258) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
|
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'uploadVolume', 'ALLOW', 259) ON DUPLICATE KEY UPDATE rule=rule;
|
||||||
@ -82,4 +82,192 @@ ALTER TABLE `cloud`.`vm_work_job` DROP INDEX `id` ;
|
|||||||
ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ;
|
ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ;
|
||||||
ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ;
|
ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ;
|
||||||
|
|
||||||
|
-- Dynamic roles changes
|
||||||
|
DROP VIEW IF EXISTS `cloud`.`account_view`;
|
||||||
|
CREATE VIEW `cloud`.`account_view` AS
|
||||||
|
select
|
||||||
|
account.id,
|
||||||
|
account.uuid,
|
||||||
|
account.account_name,
|
||||||
|
account.type,
|
||||||
|
account.role_id,
|
||||||
|
account.state,
|
||||||
|
account.removed,
|
||||||
|
account.cleanup_needed,
|
||||||
|
account.network_domain,
|
||||||
|
account.default,
|
||||||
|
domain.id domain_id,
|
||||||
|
domain.uuid domain_uuid,
|
||||||
|
domain.name domain_name,
|
||||||
|
domain.path domain_path,
|
||||||
|
data_center.id data_center_id,
|
||||||
|
data_center.uuid data_center_uuid,
|
||||||
|
data_center.name data_center_name,
|
||||||
|
account_netstats_view.bytesReceived,
|
||||||
|
account_netstats_view.bytesSent,
|
||||||
|
vmlimit.max vmLimit,
|
||||||
|
vmcount.count vmTotal,
|
||||||
|
runningvm.vmcount runningVms,
|
||||||
|
stoppedvm.vmcount stoppedVms,
|
||||||
|
iplimit.max ipLimit,
|
||||||
|
ipcount.count ipTotal,
|
||||||
|
free_ip_view.free_ip ipFree,
|
||||||
|
volumelimit.max volumeLimit,
|
||||||
|
volumecount.count volumeTotal,
|
||||||
|
snapshotlimit.max snapshotLimit,
|
||||||
|
snapshotcount.count snapshotTotal,
|
||||||
|
templatelimit.max templateLimit,
|
||||||
|
templatecount.count templateTotal,
|
||||||
|
vpclimit.max vpcLimit,
|
||||||
|
vpccount.count vpcTotal,
|
||||||
|
projectlimit.max projectLimit,
|
||||||
|
projectcount.count projectTotal,
|
||||||
|
networklimit.max networkLimit,
|
||||||
|
networkcount.count networkTotal,
|
||||||
|
cpulimit.max cpuLimit,
|
||||||
|
cpucount.count cpuTotal,
|
||||||
|
memorylimit.max memoryLimit,
|
||||||
|
memorycount.count memoryTotal,
|
||||||
|
primary_storage_limit.max primaryStorageLimit,
|
||||||
|
primary_storage_count.count primaryStorageTotal,
|
||||||
|
secondary_storage_limit.max secondaryStorageLimit,
|
||||||
|
secondary_storage_count.count secondaryStorageTotal,
|
||||||
|
async_job.id job_id,
|
||||||
|
async_job.uuid job_uuid,
|
||||||
|
async_job.job_status job_status,
|
||||||
|
async_job.account_id job_account_id
|
||||||
|
from
|
||||||
|
`cloud`.`free_ip_view`,
|
||||||
|
`cloud`.`account`
|
||||||
|
inner join
|
||||||
|
`cloud`.`domain` ON account.domain_id = domain.id
|
||||||
|
left join
|
||||||
|
`cloud`.`data_center` ON account.default_zone_id = data_center.id
|
||||||
|
left join
|
||||||
|
`cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
|
||||||
|
and vmlimit.type = 'user_vm'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
|
||||||
|
and vmcount.type = 'user_vm'
|
||||||
|
left join
|
||||||
|
`cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
|
||||||
|
and runningvm.state = 'Running'
|
||||||
|
left join
|
||||||
|
`cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
|
||||||
|
and stoppedvm.state = 'Stopped'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
|
||||||
|
and iplimit.type = 'public_ip'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
|
||||||
|
and ipcount.type = 'public_ip'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
|
||||||
|
and volumelimit.type = 'volume'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
|
||||||
|
and volumecount.type = 'volume'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
|
||||||
|
and snapshotlimit.type = 'snapshot'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
|
||||||
|
and snapshotcount.type = 'snapshot'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
|
||||||
|
and templatelimit.type = 'template'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
|
||||||
|
and templatecount.type = 'template'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
|
||||||
|
and vpclimit.type = 'vpc'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
|
||||||
|
and vpccount.type = 'vpc'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
|
||||||
|
and projectlimit.type = 'project'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
|
||||||
|
and projectcount.type = 'project'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
|
||||||
|
and networklimit.type = 'network'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
|
||||||
|
and networkcount.type = 'network'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
|
||||||
|
and cpulimit.type = 'cpu'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
|
||||||
|
and cpucount.type = 'cpu'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
|
||||||
|
and memorylimit.type = 'memory'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
|
||||||
|
and memorycount.type = 'memory'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
|
||||||
|
and primary_storage_limit.type = 'primary_storage'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
|
||||||
|
and primary_storage_count.type = 'primary_storage'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
|
||||||
|
and secondary_storage_limit.type = 'secondary_storage'
|
||||||
|
left join
|
||||||
|
`cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
|
||||||
|
and secondary_storage_count.type = 'secondary_storage'
|
||||||
|
left join
|
||||||
|
`cloud`.`async_job` ON async_job.instance_id = account.id
|
||||||
|
and async_job.instance_type = 'Account'
|
||||||
|
and async_job.job_status = 0;
|
||||||
|
|
||||||
|
DROP VIEW IF EXISTS `cloud`.`user_view`;
|
||||||
|
CREATE VIEW `cloud`.`user_view` AS
|
||||||
|
select
|
||||||
|
user.id,
|
||||||
|
user.uuid,
|
||||||
|
user.username,
|
||||||
|
user.password,
|
||||||
|
user.firstname,
|
||||||
|
user.lastname,
|
||||||
|
user.email,
|
||||||
|
user.state,
|
||||||
|
user.api_key,
|
||||||
|
user.secret_key,
|
||||||
|
user.created,
|
||||||
|
user.removed,
|
||||||
|
user.timezone,
|
||||||
|
user.registration_token,
|
||||||
|
user.is_registered,
|
||||||
|
user.incorrect_login_attempts,
|
||||||
|
user.default,
|
||||||
|
account.id account_id,
|
||||||
|
account.uuid account_uuid,
|
||||||
|
account.account_name account_name,
|
||||||
|
account.type account_type,
|
||||||
|
account.role_id account_role_id,
|
||||||
|
domain.id domain_id,
|
||||||
|
domain.uuid domain_uuid,
|
||||||
|
domain.name domain_name,
|
||||||
|
domain.path domain_path,
|
||||||
|
async_job.id job_id,
|
||||||
|
async_job.uuid job_uuid,
|
||||||
|
async_job.job_status job_status,
|
||||||
|
async_job.account_id job_account_id
|
||||||
|
from
|
||||||
|
`cloud`.`user`
|
||||||
|
inner join
|
||||||
|
`cloud`.`account` ON user.account_id = account.id
|
||||||
|
inner join
|
||||||
|
`cloud`.`domain` ON account.domain_id = domain.id
|
||||||
|
left join
|
||||||
|
`cloud`.`async_job` ON async_job.instance_id = user.id
|
||||||
|
and async_job.instance_type = 'User'
|
||||||
|
and async_job.job_status = 0;
|
||||||
|
|||||||
@ -436,3 +436,38 @@ VIEW `account_vmstats_view` AS
|
|||||||
(`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL)
|
(`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL)
|
||||||
GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`;
|
GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`;
|
||||||
-- End CLOUDSTACK-9340
|
-- End CLOUDSTACK-9340
|
||||||
|
|
||||||
|
-- Dynamic roles
|
||||||
|
CREATE TABLE IF NOT EXISTS `cloud`.`roles` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`uuid` varchar(255) UNIQUE,
|
||||||
|
`name` varchar(255) COMMENT 'unique name of the dynamic role',
|
||||||
|
`role_type` varchar(255) NOT NULL COMMENT 'the type of the role',
|
||||||
|
`removed` datetime COMMENT 'date removed',
|
||||||
|
`description` text COMMENT 'description of the role',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `i_roles__name` (`name`),
|
||||||
|
KEY `i_roles__role_type` (`role_type`),
|
||||||
|
UNIQUE KEY (`name`, `role_type`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `cloud`.`role_permissions` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`uuid` varchar(255) UNIQUE,
|
||||||
|
`role_id` bigint(20) unsigned NOT NULL COMMENT 'id of the role',
|
||||||
|
`rule` varchar(255) NOT NULL COMMENT 'rule for the role, api name or wildcard',
|
||||||
|
`permission` varchar(255) NOT NULL COMMENT 'access authority, allow or deny',
|
||||||
|
`description` text COMMENT 'description of the rule',
|
||||||
|
`sort_order` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT 'permission sort order',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `fk_role_permissions__role_id` (`role_id`),
|
||||||
|
KEY `i_role_permissions__sort_order` (`sort_order`),
|
||||||
|
UNIQUE KEY (`role_id`, `rule`),
|
||||||
|
CONSTRAINT `fk_role_permissions__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Default CloudStack roles
|
||||||
|
INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (1, UUID(), 'Root Admin', 'Admin', 'Default root admin role') ON DUPLICATE KEY UPDATE name=name;
|
||||||
|
INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (2, UUID(), 'Resource Admin', 'ResourceAdmin', 'Default resource admin role') ON DUPLICATE KEY UPDATE name=name;
|
||||||
|
INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (3, UUID(), 'Domain Admin', 'DomainAdmin', 'Default domain admin role') ON DUPLICATE KEY UPDATE name=name;
|
||||||
|
INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (4, UUID(), 'User', 'User', 'Default Root Admin role') ON DUPLICATE KEY UPDATE name=name;
|
||||||
|
|||||||
@ -25,4 +25,5 @@ INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES (1, UU
|
|||||||
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Hidden', 'DEFAULT', 'none', 'init', null, null);
|
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Hidden', 'DEFAULT', 'none', 'init', null, null);
|
||||||
-- INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xenserver.public.network.device', 'public-network', "[OPTIONAL]The name of the XenServer network containing the physical network interface that is connected to the public network ");
|
-- INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xenserver.public.network.device', 'public-network', "[OPTIONAL]The name of the XenServer network containing the physical network interface that is connected to the public network ");
|
||||||
|
|
||||||
|
-- Enable dynamic RBAC by default for fresh deployments
|
||||||
|
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value) VALUES ('Advanced', 'DEFAULT', 'RoleService', 'dynamic.apichecker.enabled', 'true');
|
||||||
|
|||||||
@ -239,6 +239,13 @@ under the License.
|
|||||||
<value>qatest-vmops.com</value>
|
<value>qatest-vmops.com</value>
|
||||||
</configuration>
|
</configuration>
|
||||||
<!--
|
<!--
|
||||||
|
Enable Dynamic RBAC by default for fresh installations
|
||||||
|
-->
|
||||||
|
<configuration>
|
||||||
|
<name>dynamic.apichecker.enabled</name>
|
||||||
|
<value>true</value>
|
||||||
|
</configuration>
|
||||||
|
<!--
|
||||||
The instance.name parameter is tacked to the end of the names of the VMs you create.
|
The instance.name parameter is tacked to the end of the names of the VMs you create.
|
||||||
So, for example, with the TEST value as it ships by default, your VMs would be named:
|
So, for example, with the TEST value as it ships by default, your VMs would be named:
|
||||||
i-X-Y-TEST, where X is the account ID and Y is the serially incrementing VM ID.
|
i-X-Y-TEST, where X is the account ID and Y is the serially incrementing VM ID.
|
||||||
|
|||||||
537
test/integration/smoke/test_dynamicroles.py
Normal file
537
test/integration/smoke/test_dynamicroles.py
Normal file
@ -0,0 +1,537 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from marvin.cloudstackAPI import *
|
||||||
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
|
from marvin.cloudstackException import CloudstackAPIException
|
||||||
|
from marvin.lib.base import Account, Role, RolePermission
|
||||||
|
from marvin.lib.utils import cleanup_resources
|
||||||
|
from nose.plugins.attrib import attr
|
||||||
|
from random import shuffle
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import random
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class TestData(object):
|
||||||
|
"""Test data object that is required to create resources
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self.testdata = {
|
||||||
|
"account": {
|
||||||
|
"email": "mtu@test.cloud",
|
||||||
|
"firstname": "Marvin",
|
||||||
|
"lastname": "TestUser",
|
||||||
|
"username": "roletest",
|
||||||
|
"password": "password",
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"name": "MarvinFake Role ",
|
||||||
|
"type": "User",
|
||||||
|
"description": "Fake Role created by Marvin test"
|
||||||
|
},
|
||||||
|
"roleadmin": {
|
||||||
|
"name": "MarvinFake Admin Role ",
|
||||||
|
"type": "Admin",
|
||||||
|
"description": "Fake Admin Role created by Marvin test"
|
||||||
|
},
|
||||||
|
"roledomainadmin": {
|
||||||
|
"name": "MarvinFake DomainAdmin Role ",
|
||||||
|
"type": "DomainAdmin",
|
||||||
|
"description": "Fake Domain-Admin Role created by Marvin test"
|
||||||
|
},
|
||||||
|
"rolepermission": {
|
||||||
|
"roleid": 1,
|
||||||
|
"rule": "listVirtualMachines",
|
||||||
|
"permission": "allow",
|
||||||
|
"description": "Fake role permission created by Marvin test"
|
||||||
|
},
|
||||||
|
"apiConfig": {
|
||||||
|
"listApis": "allow",
|
||||||
|
"listAccounts": "allow",
|
||||||
|
"listClusters": "deny",
|
||||||
|
"*VM*": "allow",
|
||||||
|
"*Host*": "deny"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestDynamicRoles(cloudstackTestCase):
|
||||||
|
"""Tests dynamic role and role permission management in CloudStack
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.apiclient = self.testClient.getApiClient()
|
||||||
|
self.dbclient = self.testClient.getDbConnection()
|
||||||
|
self.testdata = TestData().testdata
|
||||||
|
|
||||||
|
feature_enabled = self.apiclient.listCapabilities(listCapabilities.listCapabilitiesCmd()).dynamicrolesenabled
|
||||||
|
if not feature_enabled:
|
||||||
|
self.skipTest("Dynamic Role-Based API checker not enabled, skipping test")
|
||||||
|
|
||||||
|
self.testdata["role"]["name"] += self.getRandomString()
|
||||||
|
self.role = Role.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata["role"]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.testdata["rolepermission"]["roleid"] = self.role.id
|
||||||
|
self.rolepermission = RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata["rolepermission"]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.account = Account.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata["account"],
|
||||||
|
roleid=self.role.id
|
||||||
|
)
|
||||||
|
self.cleanup = [
|
||||||
|
self.account,
|
||||||
|
self.rolepermission,
|
||||||
|
self.role
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
try:
|
||||||
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
|
except Exception as e:
|
||||||
|
self.debug("Warning! Exception in tearDown: %s" % e)
|
||||||
|
|
||||||
|
|
||||||
|
def translateRoleToAccountType(self, role_type):
|
||||||
|
if role_type == "User":
|
||||||
|
return 0
|
||||||
|
elif role_type == "Admin":
|
||||||
|
return 1
|
||||||
|
elif role_type == "DomainAdmin":
|
||||||
|
return 2
|
||||||
|
elif role_type == "ResourceAdmin":
|
||||||
|
return 3
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
def getUserApiClient(self, username, domain='ROOT', role_type='User'):
|
||||||
|
self.user_apiclient = self.testClient.getUserApiClient(UserName=username, DomainName='ROOT', type=self.translateRoleToAccountType(role_type))
|
||||||
|
return self.user_apiclient
|
||||||
|
|
||||||
|
|
||||||
|
def getRandomString(self):
|
||||||
|
return "".join(random.choice("abcdefghijklmnopqrstuvwxyz0123456789") for _ in range(10))
|
||||||
|
|
||||||
|
|
||||||
|
def getRandomRoleName(self):
|
||||||
|
return "MarvinFakeRoleNewName-" + self.getRandomString()
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_lifecycle_list(self):
|
||||||
|
"""
|
||||||
|
Tests that default four roles exist
|
||||||
|
"""
|
||||||
|
roleTypes = {1: "Admin", 2: "ResourceAdmin", 3: "DomainAdmin", 4: "User"}
|
||||||
|
for idx in range(1,5):
|
||||||
|
list_roles = Role.list(self.apiclient, id=idx)
|
||||||
|
self.assertEqual(
|
||||||
|
isinstance(list_roles, list),
|
||||||
|
True,
|
||||||
|
"List Roles response was not a valid list"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
len(list_roles),
|
||||||
|
1,
|
||||||
|
"List Roles response size was not 1"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list_roles[0].type,
|
||||||
|
roleTypes[idx],
|
||||||
|
msg="Default role type differs from expectation"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_lifecycle_create(self):
|
||||||
|
"""
|
||||||
|
Tests normal lifecycle operations for roles
|
||||||
|
"""
|
||||||
|
# Reuse self.role created in setUp()
|
||||||
|
try:
|
||||||
|
role = Role.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata["role"]
|
||||||
|
)
|
||||||
|
self.fail("An exception was expected when creating duplicate roles")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
list_roles = Role.list(self.apiclient, id=self.role.id)
|
||||||
|
self.assertEqual(
|
||||||
|
isinstance(list_roles, list),
|
||||||
|
True,
|
||||||
|
"List Roles response was not a valid list"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
len(list_roles),
|
||||||
|
1,
|
||||||
|
"List Roles response size was not 1"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list_roles[0].name,
|
||||||
|
self.testdata["role"]["name"],
|
||||||
|
msg="Role name does not match the test data"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list_roles[0].type,
|
||||||
|
self.testdata["role"]["type"],
|
||||||
|
msg="Role type does not match the test data"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_lifecycle_update(self):
|
||||||
|
"""
|
||||||
|
Tests role update
|
||||||
|
"""
|
||||||
|
self.account.delete(self.apiclient)
|
||||||
|
new_role_name = self.getRandomRoleName()
|
||||||
|
self.role.update(self.apiclient, name=new_role_name, type='Admin')
|
||||||
|
update_role = Role.list(self.apiclient, id=self.role.id)[0]
|
||||||
|
self.assertEqual(
|
||||||
|
update_role.name,
|
||||||
|
new_role_name,
|
||||||
|
msg="Role name does not match updated role name"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
update_role.type,
|
||||||
|
'Admin',
|
||||||
|
msg="Role type does not match updated role type"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_lifecycle_update_role_inuse(self):
|
||||||
|
"""
|
||||||
|
Tests role update when role is in use by an account
|
||||||
|
"""
|
||||||
|
new_role_name = self.getRandomRoleName()
|
||||||
|
try:
|
||||||
|
self.role.update(self.apiclient, name=new_role_name, type='Admin')
|
||||||
|
self.fail("Updation of role type is not allowed when role is in use")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
self.role.update(self.apiclient, name=new_role_name)
|
||||||
|
update_role = Role.list(self.apiclient, id=self.role.id)[0]
|
||||||
|
self.assertEqual(
|
||||||
|
update_role.name,
|
||||||
|
new_role_name,
|
||||||
|
msg="Role name does not match updated role name"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_lifecycle_delete(self):
|
||||||
|
"""
|
||||||
|
Tests role update
|
||||||
|
"""
|
||||||
|
self.account.delete(self.apiclient)
|
||||||
|
self.role.delete(self.apiclient)
|
||||||
|
list_roles = Role.list(self.apiclient, id=self.role.id)
|
||||||
|
self.assertEqual(
|
||||||
|
list_roles,
|
||||||
|
None,
|
||||||
|
"List Roles response should be empty"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_inuse_deletion(self):
|
||||||
|
"""
|
||||||
|
Test to ensure role in use cannot be deleted
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self.role.delete(self.apiclient)
|
||||||
|
self.fail("Role with any account should not be allowed to be deleted")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_default_role_deletion(self):
|
||||||
|
"""
|
||||||
|
Test to ensure 4 default roles cannot be deleted
|
||||||
|
"""
|
||||||
|
for idx in range(1,5):
|
||||||
|
cmd = deleteRole.deleteRoleCmd()
|
||||||
|
cmd.id = idx
|
||||||
|
try:
|
||||||
|
self.apiclient.deleteRole(cmd)
|
||||||
|
self.fail("Default role got deleted with id: " + idx)
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_rolepermission_lifecycle_list(self):
|
||||||
|
"""
|
||||||
|
Tests listing of default role's permission
|
||||||
|
"""
|
||||||
|
for idx in range(1,5):
|
||||||
|
list_rolepermissions = RolePermission.list(self.apiclient, roleid=idx)
|
||||||
|
self.assertEqual(
|
||||||
|
isinstance(list_rolepermissions, list),
|
||||||
|
True,
|
||||||
|
"List rolepermissions response was not a valid list"
|
||||||
|
)
|
||||||
|
self.assertTrue(
|
||||||
|
len(list_rolepermissions) > 0,
|
||||||
|
"List rolepermissions response was empty"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_rolepermission_lifecycle_create(self):
|
||||||
|
"""
|
||||||
|
Tests creation of role permission
|
||||||
|
"""
|
||||||
|
# Reuse self.rolepermission created in setUp()
|
||||||
|
try:
|
||||||
|
rolepermission = RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata["rolepermission"]
|
||||||
|
)
|
||||||
|
self.fail("An exception was expected when creating duplicate role permissions")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
|
||||||
|
self.assertEqual(
|
||||||
|
isinstance(list_rolepermissions, list),
|
||||||
|
True,
|
||||||
|
"List rolepermissions response was not a valid list"
|
||||||
|
)
|
||||||
|
self.assertNotEqual(
|
||||||
|
len(list_rolepermissions),
|
||||||
|
0,
|
||||||
|
"List rolepermissions response was empty"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list_rolepermissions[0].rule,
|
||||||
|
self.testdata["rolepermission"]["rule"],
|
||||||
|
msg="Role permission rule does not match the test data"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list_rolepermissions[0].permission,
|
||||||
|
self.testdata["rolepermission"]["permission"],
|
||||||
|
msg="Role permission permission-type does not match the test data"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_rolepermission_lifecycle_update(self):
|
||||||
|
"""
|
||||||
|
Tests order updation of role permission
|
||||||
|
"""
|
||||||
|
permissions = [self.rolepermission]
|
||||||
|
rules = ['list*', '*Vol*', 'listCapabilities']
|
||||||
|
for rule in rules:
|
||||||
|
data = copy.deepcopy(self.testdata["rolepermission"])
|
||||||
|
data['rule'] = rule
|
||||||
|
permission = RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
self.cleanup.append(permission)
|
||||||
|
permissions.append(permission)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_permissions_list(permissions):
|
||||||
|
list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
|
||||||
|
self.assertEqual(
|
||||||
|
len(list_rolepermissions),
|
||||||
|
len(permissions),
|
||||||
|
msg="List of role permissions do not match created list of permissions"
|
||||||
|
)
|
||||||
|
|
||||||
|
for idx, rolepermission in enumerate(list_rolepermissions):
|
||||||
|
self.assertEqual(
|
||||||
|
rolepermission.rule,
|
||||||
|
permissions[idx].rule,
|
||||||
|
msg="Rule permission don't match with expected item at the index"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
rolepermission.permission,
|
||||||
|
permissions[idx].permission,
|
||||||
|
msg="Rule permission don't match with expected item at the index"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Move last item to the top
|
||||||
|
rule = permissions.pop(len(permissions)-1)
|
||||||
|
permissions = [rule] + permissions
|
||||||
|
rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
|
||||||
|
validate_permissions_list(permissions)
|
||||||
|
|
||||||
|
# Move to the bottom
|
||||||
|
rule = permissions.pop(0)
|
||||||
|
permissions = permissions + [rule]
|
||||||
|
rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
|
||||||
|
validate_permissions_list(permissions)
|
||||||
|
|
||||||
|
# Random shuffles
|
||||||
|
for _ in range(3):
|
||||||
|
shuffle(permissions)
|
||||||
|
rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
|
||||||
|
validate_permissions_list(permissions)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_rolepermission_lifecycle_concurrent_updates(self):
|
||||||
|
"""
|
||||||
|
Tests concurrent order updation of role permission
|
||||||
|
"""
|
||||||
|
permissions = [self.rolepermission]
|
||||||
|
rules = ['list*', '*Vol*', 'listCapabilities']
|
||||||
|
for rule in rules:
|
||||||
|
data = copy.deepcopy(self.testdata["rolepermission"])
|
||||||
|
data['rule'] = rule
|
||||||
|
permission = RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
self.cleanup.append(permission)
|
||||||
|
permissions.append(permission)
|
||||||
|
|
||||||
|
|
||||||
|
# The following rule is considered to be created by another mgmt server
|
||||||
|
data = copy.deepcopy(self.testdata["rolepermission"])
|
||||||
|
data['rule'] = "someRule*"
|
||||||
|
permission = RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
self.cleanup.append(permission)
|
||||||
|
|
||||||
|
shuffle(permissions)
|
||||||
|
try:
|
||||||
|
permission.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
|
||||||
|
self.fail("Reordering should fail in case of concurrent updates by other user")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_rolepermission_lifecycle_delete(self):
|
||||||
|
"""
|
||||||
|
Tests deletion of role permission
|
||||||
|
"""
|
||||||
|
permission = self.cleanup.pop(1)
|
||||||
|
permission.delete(self.apiclient)
|
||||||
|
list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
|
||||||
|
self.assertEqual(
|
||||||
|
list_rolepermissions,
|
||||||
|
None,
|
||||||
|
"List rolepermissions response should be empty"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def checkApiAvailability(self, apiConfig, userApiClient):
|
||||||
|
"""
|
||||||
|
Checks available APIs based on api map
|
||||||
|
"""
|
||||||
|
response = userApiClient.listApis(listApis.listApisCmd())
|
||||||
|
allowedApis = map(lambda x: x.name, response)
|
||||||
|
for api in allowedApis:
|
||||||
|
for rule, perm in apiConfig.items():
|
||||||
|
if re.match(rule.replace('*', '.*'), api):
|
||||||
|
if perm.lower() == 'allow':
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.fail('Denied API found to be allowed: ' + api)
|
||||||
|
|
||||||
|
|
||||||
|
def checkApiCall(self, apiConfig, userApiClient):
|
||||||
|
"""
|
||||||
|
Performs actual API calls to verify API ACLs
|
||||||
|
"""
|
||||||
|
list_accounts = userApiClient.listAccounts(listAccounts.listAccountsCmd())
|
||||||
|
self.assertEqual(
|
||||||
|
isinstance(list_accounts, list),
|
||||||
|
True,
|
||||||
|
"List accounts response was not a valid list"
|
||||||
|
)
|
||||||
|
self.assertNotEqual(
|
||||||
|
len(list_accounts),
|
||||||
|
0,
|
||||||
|
"List accounts response was empty"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Perform actual API call for deny API
|
||||||
|
try:
|
||||||
|
userApiClient.listHosts(listHosts.listHostsCmd())
|
||||||
|
self.fail("API call succeeded which is denied for the role")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
# Perform actual API call for API with no allow/deny rule
|
||||||
|
try:
|
||||||
|
userApiClient.listZones(listZones.listZonesCmd())
|
||||||
|
self.fail("API call succeeded which has no allow/deny rule for the role")
|
||||||
|
except CloudstackAPIException: pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_account_acls(self):
|
||||||
|
"""
|
||||||
|
Test to check role, role permissions and account life cycles
|
||||||
|
"""
|
||||||
|
apiConfig = self.testdata['apiConfig']
|
||||||
|
for api, perm in apiConfig.items():
|
||||||
|
testdata = self.testdata['rolepermission']
|
||||||
|
testdata['roleid'] = self.role.id
|
||||||
|
testdata['rule'] = api
|
||||||
|
testdata['permission'] = perm.lower()
|
||||||
|
|
||||||
|
RolePermission.create(
|
||||||
|
self.apiclient,
|
||||||
|
testdata
|
||||||
|
)
|
||||||
|
|
||||||
|
userApiClient = self.getUserApiClient(self.account.name, domain=self.account.domain, role_type=self.account.roletype)
|
||||||
|
|
||||||
|
# Perform listApis check
|
||||||
|
self.checkApiAvailability(apiConfig, userApiClient)
|
||||||
|
|
||||||
|
# Perform actual API call for allow API
|
||||||
|
self.checkApiCall(apiConfig, userApiClient)
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_role_account_acls_multiple_mgmt_servers(self):
|
||||||
|
"""
|
||||||
|
Test for role-rule enforcement in case of multiple mgmt servers
|
||||||
|
Inserts rule directly in DB and checks expected behaviour
|
||||||
|
"""
|
||||||
|
apiConfig = self.testdata["apiConfig"]
|
||||||
|
roleId = self.dbclient.execute("select id from roles where uuid='%s'" % self.role.id)[0][0]
|
||||||
|
sortOrder = 1
|
||||||
|
for rule, perm in apiConfig.items():
|
||||||
|
self.dbclient.execute("insert into role_permissions (uuid, role_id, rule, permission, sort_order) values (UUID(), %d, '%s', '%s', %d)" % (roleId, rule, perm.upper(), sortOrder))
|
||||||
|
sortOrder += 1
|
||||||
|
|
||||||
|
userApiClient = self.getUserApiClient(self.account.name, domain=self.account.domain, role_type=self.account.roletype)
|
||||||
|
|
||||||
|
# Perform listApis check
|
||||||
|
self.checkApiAvailability(apiConfig, userApiClient)
|
||||||
|
|
||||||
|
# Perform actual API call for allow API
|
||||||
|
self.checkApiCall(apiConfig, userApiClient)
|
||||||
134
test/integration/smoke/test_staticroles.py
Normal file
134
test/integration/smoke/test_staticroles.py
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from marvin.cloudstackAPI import *
|
||||||
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
|
from marvin.cloudstackException import CloudstackAPIException
|
||||||
|
from marvin.lib.base import Account
|
||||||
|
from marvin.lib.utils import cleanup_resources
|
||||||
|
from marvin.sshClient import SshClient
|
||||||
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class TestStaticRoles(cloudstackTestCase):
|
||||||
|
"""Tests static role api-checker
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.apiclient = self.testClient.getApiClient()
|
||||||
|
self.dbclient = self.testClient.getDbConnection()
|
||||||
|
self.mgtSvrDetails = self.config.__dict__["mgtSvr"][0].__dict__
|
||||||
|
self.cleanup = []
|
||||||
|
self.testdata = {
|
||||||
|
"account": {
|
||||||
|
"email": "mtu@test.cloud",
|
||||||
|
"firstname": "Marvin",
|
||||||
|
"lastname": "TestUser",
|
||||||
|
"username": "staticrole_acctest-",
|
||||||
|
"password": "password",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
feature_enabled = self.apiclient.listCapabilities(listCapabilities.listCapabilitiesCmd()).dynamicrolesenabled
|
||||||
|
if feature_enabled:
|
||||||
|
self.skipTest("Dynamic role-based API checker is enabled, skipping tests for static role-base API checker")
|
||||||
|
|
||||||
|
commandsProperties = []
|
||||||
|
try:
|
||||||
|
sshClient = SshClient(
|
||||||
|
self.mgtSvrDetails["mgtSvrIp"],
|
||||||
|
22,
|
||||||
|
self.mgtSvrDetails["user"],
|
||||||
|
self.mgtSvrDetails["passwd"],
|
||||||
|
retries=1,
|
||||||
|
log_lvl=logging.INFO
|
||||||
|
)
|
||||||
|
result = sshClient.runCommand("cat /etc/cloudstack/management/commands.properties")
|
||||||
|
if 'status' in result and result['status'] == 'SUCCESS' and 'stdout' in result and len(result['stdout']) > 0:
|
||||||
|
commandsProperties = result['stdout']
|
||||||
|
except Exception:
|
||||||
|
self.debug("Failed to ssh into mgmt server host and grab commands.properties file")
|
||||||
|
testDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||||
|
localFileName = os.path.abspath(testDir + "/../../../client/tomcatconf/commands.properties.in")
|
||||||
|
if os.path.isfile(localFileName):
|
||||||
|
self.info("Detected that we're running in developer mode with maven, using file at:" + localFileName)
|
||||||
|
with open(localFileName) as f:
|
||||||
|
commandsProperties = f.readlines()
|
||||||
|
|
||||||
|
if len(commandsProperties) < 1:
|
||||||
|
self.skipTest("Unable to find commands.properties, skipping this test")
|
||||||
|
|
||||||
|
apiMap = {}
|
||||||
|
for line in commandsProperties:
|
||||||
|
if not line or line == '' or line == '\n' or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
name, value = line.split('=')
|
||||||
|
apiMap[name.strip()] = value.strip()
|
||||||
|
|
||||||
|
self.roleApiMap = {} # role to list of apis allowed
|
||||||
|
octetKey = {'Admin':1, 'DomainAdmin':4, 'User':8}
|
||||||
|
for role in octetKey.keys():
|
||||||
|
for api in sorted(apiMap.keys()):
|
||||||
|
if (octetKey[role] & int(apiMap[api])) > 0:
|
||||||
|
if role not in self.roleApiMap:
|
||||||
|
self.roleApiMap[role] = []
|
||||||
|
self.roleApiMap[role].append(api)
|
||||||
|
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
try:
|
||||||
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
|
except Exception as e:
|
||||||
|
self.debug("Warning! Exception in tearDown: %s" % e)
|
||||||
|
|
||||||
|
|
||||||
|
def translateRoleToAccountType(self, role_type):
|
||||||
|
if role_type == 'User':
|
||||||
|
return 0
|
||||||
|
elif role_type == 'Admin':
|
||||||
|
return 1
|
||||||
|
elif role_type == 'DomainAdmin':
|
||||||
|
return 2
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
|
||||||
|
def test_static_role_account_acls(self):
|
||||||
|
"""
|
||||||
|
Tests allowed APIs for common account types
|
||||||
|
"""
|
||||||
|
for role in ['Admin', 'DomainAdmin', 'User']:
|
||||||
|
accountType = self.translateRoleToAccountType(role)
|
||||||
|
account = Account.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.testdata['account'],
|
||||||
|
admin=accountType
|
||||||
|
)
|
||||||
|
self.cleanup.append(account)
|
||||||
|
userApiClient = self.testClient.getUserApiClient(UserName=account.name, DomainName=account.domain, type=accountType)
|
||||||
|
allowedApis = map(lambda x: x.name, userApiClient.listApis(listApis.listApisCmd()))
|
||||||
|
allApis = map(lambda x: x.name, self.apiclient.listApis(listApis.listApisCmd()))
|
||||||
|
for api in self.roleApiMap[role]:
|
||||||
|
if api not in allApis:
|
||||||
|
continue
|
||||||
|
if api not in allowedApis:
|
||||||
|
self.fail("API configured in commands.properties not returned by listApis: " + api + " for role: " + role)
|
||||||
@ -73,6 +73,7 @@ known_categories = {
|
|||||||
'Host': 'Host',
|
'Host': 'Host',
|
||||||
'Cluster': 'Cluster',
|
'Cluster': 'Cluster',
|
||||||
'Account': 'Account',
|
'Account': 'Account',
|
||||||
|
'Role': 'Role',
|
||||||
'Snapshot': 'Snapshot',
|
'Snapshot': 'Snapshot',
|
||||||
'User': 'User',
|
'User': 'User',
|
||||||
'Os': 'Guest OS',
|
'Os': 'Guest OS',
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class CSConnection(object):
|
|||||||
["=".join(
|
["=".join(
|
||||||
[str.lower(r[0]),
|
[str.lower(r[0]),
|
||||||
str.lower(
|
str.lower(
|
||||||
urllib.quote_plus(str(r[1]))
|
urllib.quote_plus(str(r[1]), safe="*")
|
||||||
).replace("+", "%20")]
|
).replace("+", "%20")]
|
||||||
) for r in params]
|
) for r in params]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -87,13 +87,96 @@ class Domain:
|
|||||||
return(apiclient.listDomains(cmd))
|
return(apiclient.listDomains(cmd))
|
||||||
|
|
||||||
|
|
||||||
|
class Role:
|
||||||
|
"""Manage Role"""
|
||||||
|
|
||||||
|
def __init__(self, items):
|
||||||
|
self.__dict__.update(items)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, apiclient, services, domainid=None):
|
||||||
|
"""Create role"""
|
||||||
|
cmd = createRole.createRoleCmd()
|
||||||
|
cmd.name = services["name"]
|
||||||
|
cmd.type = services["type"]
|
||||||
|
if "description" in services:
|
||||||
|
cmd.description = services["description"]
|
||||||
|
|
||||||
|
return Role(apiclient.createRole(cmd).__dict__)
|
||||||
|
|
||||||
|
def delete(self, apiclient):
|
||||||
|
"""Delete Role"""
|
||||||
|
|
||||||
|
cmd = deleteRole.deleteRoleCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
apiclient.deleteRole(cmd)
|
||||||
|
|
||||||
|
def update(self, apiclient, **kwargs):
|
||||||
|
"""Update the role"""
|
||||||
|
|
||||||
|
cmd = updateRole.updateRoleCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return apiclient.updateRole(cmd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def list(cls, apiclient, **kwargs):
|
||||||
|
"""List all Roles matching criteria"""
|
||||||
|
|
||||||
|
cmd = listRoles.listRolesCmd()
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.listRoles(cmd))
|
||||||
|
|
||||||
|
|
||||||
|
class RolePermission:
|
||||||
|
"""Manage Role Permission"""
|
||||||
|
|
||||||
|
def __init__(self, items):
|
||||||
|
self.__dict__.update(items)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, apiclient, services, domainid=None):
|
||||||
|
"""Create role permission"""
|
||||||
|
cmd = createRolePermission.createRolePermissionCmd()
|
||||||
|
cmd.roleid = services["roleid"]
|
||||||
|
cmd.rule = services["rule"]
|
||||||
|
cmd.permission = services["permission"]
|
||||||
|
if "description" in services:
|
||||||
|
cmd.description = services["description"]
|
||||||
|
|
||||||
|
return RolePermission(apiclient.createRolePermission(cmd).__dict__)
|
||||||
|
|
||||||
|
def delete(self, apiclient):
|
||||||
|
"""Delete role permission"""
|
||||||
|
|
||||||
|
cmd = deleteRolePermission.deleteRolePermissionCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
apiclient.deleteRolePermission(cmd)
|
||||||
|
|
||||||
|
def update(self, apiclient, **kwargs):
|
||||||
|
"""Update the role permission"""
|
||||||
|
|
||||||
|
cmd = updateRolePermission.updateRolePermissionCmd()
|
||||||
|
cmd.roleid = self.roleid
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return apiclient.updateRolePermission(cmd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def list(cls, apiclient, **kwargs):
|
||||||
|
"""List all role permissions matching criteria"""
|
||||||
|
|
||||||
|
cmd = listRolePermissions.listRolePermissionsCmd()
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.listRolePermissions(cmd))
|
||||||
|
|
||||||
|
|
||||||
class Account:
|
class Account:
|
||||||
""" Account Life Cycle """
|
""" Account Life Cycle """
|
||||||
def __init__(self, items):
|
def __init__(self, items):
|
||||||
self.__dict__.update(items)
|
self.__dict__.update(items)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, apiclient, services, admin=False, domainid=None):
|
def create(cls, apiclient, services, admin=False, domainid=None, roleid=None):
|
||||||
"""Creates an account"""
|
"""Creates an account"""
|
||||||
cmd = createAccount.createAccountCmd()
|
cmd = createAccount.createAccountCmd()
|
||||||
|
|
||||||
@ -121,6 +204,10 @@ class Account:
|
|||||||
|
|
||||||
if domainid:
|
if domainid:
|
||||||
cmd.domainid = domainid
|
cmd.domainid = domainid
|
||||||
|
|
||||||
|
if roleid:
|
||||||
|
cmd.roleid = roleid
|
||||||
|
|
||||||
account = apiclient.createAccount(cmd)
|
account = apiclient.createAccount(cmd)
|
||||||
|
|
||||||
return Account(account.__dict__)
|
return Account(account.__dict__)
|
||||||
|
|||||||
@ -2904,6 +2904,15 @@ div.detail-group.actions td {
|
|||||||
background-position: -366px -239px;
|
background-position: -366px -239px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#navigation ul li.roles span.icon {
|
||||||
|
background-position: -460px -80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation ul li.roles.active span.icon,
|
||||||
|
#navigation ul li.roles:hover span.icon {
|
||||||
|
background-position: -469px -750px;
|
||||||
|
}
|
||||||
|
|
||||||
#navigation ul li.accounts span.icon {
|
#navigation ul li.accounts span.icon {
|
||||||
background-position: -458px -19px;
|
background-position: -458px -19px;
|
||||||
}
|
}
|
||||||
@ -13162,3 +13171,10 @@ div.gpugroups div.list-view {
|
|||||||
background: transparent url("../images/icons.png") no-repeat -626px -209px;
|
background: transparent url("../images/icons.png") no-repeat -626px -209px;
|
||||||
padding: 0 0 3px 18px;
|
padding: 0 0 3px 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.ui-autocomplete.ui-menu {
|
||||||
|
width: 250px;
|
||||||
|
background: #ddd;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|||||||
@ -1120,7 +1120,14 @@ dictionary = {
|
|||||||
'label.retry.interval': '<fmt:message key="label.retry.interval" />',
|
'label.retry.interval': '<fmt:message key="label.retry.interval" />',
|
||||||
'label.review': '<fmt:message key="label.review" />',
|
'label.review': '<fmt:message key="label.review" />',
|
||||||
'label.revoke.project.invite': '<fmt:message key="label.revoke.project.invite" />',
|
'label.revoke.project.invite': '<fmt:message key="label.revoke.project.invite" />',
|
||||||
|
'label.permission': '<fmt:message key="label.permission" />',
|
||||||
'label.role': '<fmt:message key="label.role" />',
|
'label.role': '<fmt:message key="label.role" />',
|
||||||
|
'label.roles': '<fmt:message key="label.roles" />',
|
||||||
|
'label.roletype': '<fmt:message key="label.roletype" />',
|
||||||
|
'label.add.role': '<fmt:message key="label.add.role" />',
|
||||||
|
'label.edit.role': '<fmt:message key="label.edit.role" />',
|
||||||
|
'label.delete.role': '<fmt:message key="label.delete.role" />',
|
||||||
|
'message.role.ordering.fail': '<fmt:message key="message.role.ordering.fail" />',
|
||||||
'label.root.disk.controller': '<fmt:message key="label.root.disk.controller" />',
|
'label.root.disk.controller': '<fmt:message key="label.root.disk.controller" />',
|
||||||
'label.root.disk.offering': '<fmt:message key="label.root.disk.offering" />',
|
'label.root.disk.offering': '<fmt:message key="label.root.disk.offering" />',
|
||||||
'message.configure.firewall.rules.allow.traffic': '<fmt:message key="message.configure.firewall.rules.allow.traffic" />',
|
'message.configure.firewall.rules.allow.traffic': '<fmt:message key="message.configure.firewall.rules.allow.traffic" />',
|
||||||
|
|||||||
@ -26,6 +26,7 @@ under the License.
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$.extend(dictionary, {
|
$.extend(dictionary, {
|
||||||
'label.add.ldap.account': '<fmt:message key="label.add.ldap.account" />',
|
'label.add.ldap.account': '<fmt:message key="label.add.ldap.account" />',
|
||||||
|
'label.rule': '<fmt:message key="label.rule" />',
|
||||||
'label.rules': '<fmt:message key="label.rules" />',
|
'label.rules': '<fmt:message key="label.rules" />',
|
||||||
'label.running.vms': '<fmt:message key="label.running.vms" />',
|
'label.running.vms': '<fmt:message key="label.running.vms" />',
|
||||||
'label.s3.access_key': '<fmt:message key="label.s3.access_key" />',
|
'label.s3.access_key': '<fmt:message key="label.s3.access_key" />',
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 47 KiB |
@ -1823,6 +1823,7 @@
|
|||||||
<script type="text/javascript" src="scripts/ui-custom/uploadVolume.js"></script>
|
<script type="text/javascript" src="scripts/ui-custom/uploadVolume.js"></script>
|
||||||
<script type="text/javascript" src="scripts/storage.js"></script>
|
<script type="text/javascript" src="scripts/storage.js"></script>
|
||||||
<script type="text/javascript" src="scripts/templates.js"></script>
|
<script type="text/javascript" src="scripts/templates.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/roles.js"></script>
|
||||||
<script type="text/javascript" src="scripts/accountsWizard.js"></script>
|
<script type="text/javascript" src="scripts/accountsWizard.js"></script>
|
||||||
<script type="text/javascript" src="scripts/ui-custom/accountsWizard.js"></script>
|
<script type="text/javascript" src="scripts/ui-custom/accountsWizard.js"></script>
|
||||||
<script type="text/javascript" src="scripts/accounts.js"></script>
|
<script type="text/javascript" src="scripts/accounts.js"></script>
|
||||||
|
|||||||
@ -25,12 +25,18 @@
|
|||||||
id: 'quota',
|
id: 'quota',
|
||||||
title: 'Quota',
|
title: 'Quota',
|
||||||
preFilter: function(args) {
|
preFilter: function(args) {
|
||||||
var retval = $.ajax({
|
var pluginEnabled = false;
|
||||||
|
$.ajax({
|
||||||
url: createURL("quotaIsEnabled"),
|
url: createURL("quotaIsEnabled"),
|
||||||
async: false
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
pluginEnabled = json.quotaisenabledresponse.isenabled.isenabled;
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
pluginEnabled = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var json = JSON.parse(retval.responseText);
|
return pluginEnabled;
|
||||||
return json.quotaisenabledresponse.isenabled.isenabled;
|
|
||||||
},
|
},
|
||||||
showOnNavigation: true,
|
showOnNavigation: true,
|
||||||
sectionSelect: {
|
sectionSelect: {
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
(function(cloudStack) {
|
(function(cloudStack) {
|
||||||
|
|
||||||
var domainObjs;
|
var domainObjs;
|
||||||
|
var roleObjs;
|
||||||
|
|
||||||
cloudStack.sections.accounts = {
|
cloudStack.sections.accounts = {
|
||||||
title: 'label.accounts',
|
title: 'label.accounts',
|
||||||
@ -38,11 +39,11 @@
|
|||||||
name: {
|
name: {
|
||||||
label: 'label.name'
|
label: 'label.name'
|
||||||
},
|
},
|
||||||
accounttype: {
|
rolename: {
|
||||||
label: 'label.role',
|
label: 'label.role'
|
||||||
converter: function(args) {
|
},
|
||||||
return cloudStack.converters.toRole(args);
|
roletype: {
|
||||||
}
|
label: 'label.roletype'
|
||||||
},
|
},
|
||||||
domain: {
|
domain: {
|
||||||
label: 'label.domain'
|
label: 'label.domain'
|
||||||
@ -678,11 +679,11 @@
|
|||||||
id: {
|
id: {
|
||||||
label: 'label.id'
|
label: 'label.id'
|
||||||
},
|
},
|
||||||
accounttype: {
|
rolename: {
|
||||||
label: 'label.role',
|
label: 'label.role'
|
||||||
converter: function(args) {
|
},
|
||||||
return cloudStack.converters.toRole(args);
|
roletype: {
|
||||||
}
|
label: 'label.roletype'
|
||||||
},
|
},
|
||||||
domain: {
|
domain: {
|
||||||
label: 'label.domain'
|
label: 'label.domain'
|
||||||
@ -1570,11 +1571,11 @@
|
|||||||
account: {
|
account: {
|
||||||
label: 'label.account.name'
|
label: 'label.account.name'
|
||||||
},
|
},
|
||||||
accounttype: {
|
rolename: {
|
||||||
label: 'label.role',
|
label: 'label.role'
|
||||||
converter: function(args) {
|
},
|
||||||
return cloudStack.converters.toRole(args);
|
roletype: {
|
||||||
}
|
label: 'label.roletype'
|
||||||
},
|
},
|
||||||
domain: {
|
domain: {
|
||||||
label: 'label.domain'
|
label: 'label.domain'
|
||||||
|
|||||||
@ -110,26 +110,30 @@
|
|||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
accounttype: {
|
roleid: {
|
||||||
label: 'label.type',
|
label: 'label.role',
|
||||||
docID: 'helpAccountType',
|
docID: 'helpAccountType',
|
||||||
validation: {
|
validation: {
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
select: function(args) {
|
select: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listRoles"),
|
||||||
|
success: function(json) {
|
||||||
var items = [];
|
var items = [];
|
||||||
|
roleObjs = json.listrolesresponse.role;
|
||||||
|
$(roleObjs).each(function() {
|
||||||
items.push({
|
items.push({
|
||||||
id: 0,
|
id: this.id,
|
||||||
description: "User"
|
description: this.name + ' (' + this.type + ')'
|
||||||
}); //regular-user
|
});
|
||||||
items.push({
|
});
|
||||||
id: 1,
|
|
||||||
description: "Admin"
|
|
||||||
}); //root-admin
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
data: items
|
data: items
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
timezone: {
|
timezone: {
|
||||||
label: 'label.timezone',
|
label: 'label.timezone',
|
||||||
@ -226,13 +230,9 @@
|
|||||||
array1.push("&account=" + account);
|
array1.push("&account=" + account);
|
||||||
}
|
}
|
||||||
|
|
||||||
var accountType = args.data.accounttype;
|
if (args.data.roleid) {
|
||||||
if (accountType == "1") { //if "admin" is selected in account type dropdown
|
array1.push("&roleid=" + args.data.roleid);
|
||||||
if (rootDomainId == undefined || args.data.domainid != rootDomainId ) { //but current login has no visibility to root domain object, or the selected domain is not root domain
|
|
||||||
accountType = "2"; // change accountType from root-domain("1") to domain-admin("2")
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
array1.push("&accounttype=" + accountType);
|
|
||||||
|
|
||||||
if (args.data.timezone !== null && args.data.timezone.length > 0) {
|
if (args.data.timezone !== null && args.data.timezone.length > 0) {
|
||||||
array1.push("&timezone=" + args.data.timezone);
|
array1.push("&timezone=" + args.data.timezone);
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
var sections = [];
|
var sections = [];
|
||||||
|
|
||||||
if (isAdmin()) {
|
if (isAdmin()) {
|
||||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"];
|
sections = ["dashboard", "instances", "storage", "network", "templates", "roles", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"];
|
||||||
} else if (isDomainAdmin()) {
|
} else if (isDomainAdmin()) {
|
||||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "configuration", "regions", "affinityGroups"];
|
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "configuration", "regions", "affinityGroups"];
|
||||||
} else if (g_userProjectsEnabled) {
|
} else if (g_userProjectsEnabled) {
|
||||||
@ -52,6 +52,7 @@
|
|||||||
templates: {},
|
templates: {},
|
||||||
events: {},
|
events: {},
|
||||||
projects: {},
|
projects: {},
|
||||||
|
roles: {},
|
||||||
accounts: {},
|
accounts: {},
|
||||||
|
|
||||||
domains: {}, //domain-admin and root-admin only
|
domains: {}, //domain-admin and root-admin only
|
||||||
|
|||||||
388
ui/scripts/roles.js
Normal file
388
ui/scripts/roles.js
Normal file
@ -0,0 +1,388 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
(function($, cloudStack) {
|
||||||
|
var apiList = [];
|
||||||
|
var rolePermissions = [];
|
||||||
|
cloudStack.sections.roles = {
|
||||||
|
title: 'label.roles',
|
||||||
|
id: 'roles',
|
||||||
|
listView: {
|
||||||
|
id: 'roles',
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name'
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
label: 'label.type'
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
label: 'label.description'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disableInfiniteScrolling: true,
|
||||||
|
dataProvider: function(args) {
|
||||||
|
var data = {};
|
||||||
|
if (args.filterBy.search && args.filterBy.search.value) {
|
||||||
|
data['name'] = args.filterBy.search.value;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listRoles"),
|
||||||
|
data: data,
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var jsonObj;
|
||||||
|
jsonObj = json.listrolesresponse.role;
|
||||||
|
args.response.success({
|
||||||
|
data: jsonObj
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
label: 'label.add.role',
|
||||||
|
preFilter: function(args) {
|
||||||
|
if (isAdmin())
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
notification: function() {
|
||||||
|
return 'label.add.role';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createForm: {
|
||||||
|
title: 'label.add.role',
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
label: 'label.description',
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
label: 'label.type',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
select: function(args) {
|
||||||
|
var items = [];
|
||||||
|
items.push({
|
||||||
|
id: "Admin",
|
||||||
|
description: "Admin"
|
||||||
|
});
|
||||||
|
items.push({
|
||||||
|
id: "DomainAdmin",
|
||||||
|
description: "Domain Admin"
|
||||||
|
});
|
||||||
|
items.push({
|
||||||
|
id: "User",
|
||||||
|
description: "User"
|
||||||
|
});
|
||||||
|
args.response.success({
|
||||||
|
data: items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('createRole'),
|
||||||
|
data: args.data,
|
||||||
|
success: function(json) {
|
||||||
|
var item = json.createroleresponse.role;
|
||||||
|
args.response.success({
|
||||||
|
data: item
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
notification: {
|
||||||
|
poll: function(args) {
|
||||||
|
args.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
detailView: {
|
||||||
|
tabs: {
|
||||||
|
details: {
|
||||||
|
title: 'label.details',
|
||||||
|
fields: {
|
||||||
|
id: {
|
||||||
|
label: 'label.id'
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
label: 'label.name',
|
||||||
|
isEditable: true,
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
label: 'label.type'
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
label: 'label.description',
|
||||||
|
isEditable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataProvider: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listRoles&id=" + args.context.roles[0].id),
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var response = json.listrolesresponse.role[0];
|
||||||
|
args.response.success({
|
||||||
|
data: response
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
title: 'label.rules',
|
||||||
|
custom: function(args) {
|
||||||
|
var context = args.context;
|
||||||
|
|
||||||
|
return $('<div>').multiEdit({
|
||||||
|
context: context,
|
||||||
|
noSelect: true,
|
||||||
|
noHeaderActionsColumn: true,
|
||||||
|
reorder: {
|
||||||
|
moveDrag: {
|
||||||
|
action: function(args) {
|
||||||
|
var rule = args.context.multiRule[0];
|
||||||
|
var prevItemId = args.prevItem ? args.prevItem.id : 0;
|
||||||
|
|
||||||
|
var ruleOrder = [];
|
||||||
|
$.each(rolePermissions, function(idx, item) {
|
||||||
|
var itemId = item.id;
|
||||||
|
if (idx == 0 && prevItemId == 0) {
|
||||||
|
ruleOrder.push(rule.id);
|
||||||
|
}
|
||||||
|
if (itemId == rule.id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ruleOrder.push(item.id);
|
||||||
|
if (prevItemId == itemId) {
|
||||||
|
ruleOrder.push(rule.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('updateRolePermission'),
|
||||||
|
data: {
|
||||||
|
roleid: rule.roleid,
|
||||||
|
ruleorder: ruleOrder.join()
|
||||||
|
},
|
||||||
|
success: function(json) {
|
||||||
|
args.response.success();
|
||||||
|
$(window).trigger('cloudStack.fullRefresh');
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
cloudStack.dialog.notice({
|
||||||
|
message: 'message.role.ordering.fail'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
'rule': {
|
||||||
|
edit: true,
|
||||||
|
label: 'label.rule',
|
||||||
|
isOptional: false
|
||||||
|
},
|
||||||
|
'permission': {
|
||||||
|
label: 'label.permission',
|
||||||
|
select: function(args) {
|
||||||
|
args.response.success({
|
||||||
|
data: [{
|
||||||
|
name: 'allow',
|
||||||
|
description: 'Allow'
|
||||||
|
}, {
|
||||||
|
name: 'deny',
|
||||||
|
description: 'Deny'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'description': {
|
||||||
|
edit: true,
|
||||||
|
label: 'label.description',
|
||||||
|
isOptional: true
|
||||||
|
},
|
||||||
|
'always-hide': {
|
||||||
|
label: 'label.action',
|
||||||
|
addButton: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
add: {
|
||||||
|
label: 'label.add',
|
||||||
|
action: function(args) {
|
||||||
|
var data = {
|
||||||
|
rule: args.data.rule,
|
||||||
|
permission: args.data.permission,
|
||||||
|
description: args.data.description,
|
||||||
|
roleid: args.context.roles[0].id
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('createRolePermission'),
|
||||||
|
data: data,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(json) {
|
||||||
|
var response = json.createrolepermissionresponse.rolepermission;
|
||||||
|
args.response.success({
|
||||||
|
data: response
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
destroy: {
|
||||||
|
label: 'label.remove.rule',
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('deleteRolePermission'),
|
||||||
|
data: {
|
||||||
|
id: args.context.multiRule[0].id
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
args.response.success();
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataProvider: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listRolePermissions'),
|
||||||
|
data: {
|
||||||
|
roleid: args.context.roles[0].id
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(json) {
|
||||||
|
var rules = json.listrolepermissionsresponse.rolepermission;
|
||||||
|
if (rules) {
|
||||||
|
rolePermissions = rules;
|
||||||
|
}
|
||||||
|
args.response.success({
|
||||||
|
data: rules
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var setupAutocompletion = function() {
|
||||||
|
$($.find('input[name="rule"]')).autocomplete("destroy");
|
||||||
|
$($.find('input[name="rule"]')).autocomplete({
|
||||||
|
source: apiList,
|
||||||
|
autoFocus:true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (apiList.length == 0) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listApis"),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var response = json.listapisresponse.api;
|
||||||
|
$.each(response, function(idx, api) {
|
||||||
|
apiList.push(api.name);
|
||||||
|
});
|
||||||
|
setupAutocompletion();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setupAutocompletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
edit: {
|
||||||
|
label: 'label.edit.role',
|
||||||
|
action: function(args) {
|
||||||
|
var data = {
|
||||||
|
id: args.context.roles[0].id,
|
||||||
|
name: args.data.name,
|
||||||
|
description: args.data.description
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('updateRole'),
|
||||||
|
data: data,
|
||||||
|
success: function(json) {
|
||||||
|
args.response.success();
|
||||||
|
},
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remove: {
|
||||||
|
label: 'label.delete.role',
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'label.delete.role';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.delete.role';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("deleteRole&id=" + args.context.roles[0].id),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var response = json.deleteroleresponse;
|
||||||
|
args.response.success({
|
||||||
|
data: response
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
notification: {
|
||||||
|
poll: function(args) {
|
||||||
|
args.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})(jQuery, cloudStack);
|
||||||
@ -1112,6 +1112,17 @@ cloudStack.converters = {
|
|||||||
return "Domain-Admin";
|
return "Domain-Admin";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
toAccountType: function(roleType) {
|
||||||
|
if (roleType == 'User') {
|
||||||
|
return 0;
|
||||||
|
} else if (roleType == 'Admin') {
|
||||||
|
return 1;
|
||||||
|
} else if (roleType == 'DomainAdmin') {
|
||||||
|
return 2;
|
||||||
|
} else if (roleType == 'ResourceAdmin') {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
},
|
||||||
toAlertType: function(alertCode) {
|
toAlertType: function(alertCode) {
|
||||||
switch (alertCode) {
|
switch (alertCode) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
31
utils/src/main/java/com/cloud/utils/ListUtils.java
Normal file
31
utils/src/main/java/com/cloud/utils/ListUtils.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package com.cloud.utils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ListUtils {
|
||||||
|
public static <T> List<T> toListOfInterface(final List<? extends T> items) {
|
||||||
|
if (items != null) {
|
||||||
|
return new ArrayList<>(items);
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,6 +34,10 @@ import org.apache.log4j.Logger;
|
|||||||
public class PropertiesUtil {
|
public class PropertiesUtil {
|
||||||
private static final Logger s_logger = Logger.getLogger(PropertiesUtil.class);
|
private static final Logger s_logger = Logger.getLogger(PropertiesUtil.class);
|
||||||
|
|
||||||
|
public static String getDefaultApiCommandsFileName() {
|
||||||
|
return "commands.properties";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the class path and local paths to find the config file.
|
* Searches the class path and local paths to find the config file.
|
||||||
* @param path path to find. if it starts with / then it's absolute path.
|
* @param path path to find. if it starts with / then it's absolute path.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user