76 Commits

Author SHA1 Message Date
Rohit Yadav
4347776ac6 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>
2016-05-11 09:45:19 +05:30
Rajani Karuturi
843f6b1691 CLOUDSTACK-5236 : ability to identify where the user is from (ex. LDAP)
Added a source column to the user table.

Source now has only two values UNKNOWN,LDAP with UNKNOWN being the
default and is an enum is com.cloud.User.

When the source is UNKNOWN, the old method of authenticating against all
the available authenticators is used. If a source is available, only
that particular authenticator will be used.

added overloaded methods in AccountService to createUserAccount and
createUser with source specified.

(cherry picked from commit 5da733072e838c830720909ef5ba27ef6ce6d0b0)
2015-03-16 14:53:53 +05:30
Rohit Yadav
a75ff23131 CLOUDSTACK-8273: fix baremetal account creation
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit e000646790597cb6c245311f57761b41d23a4e34)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
2015-02-27 15:55:09 +05:30
Wei Zhou
af2f21894c CLOUDSTACK-7983: Create Disk/Service Offering for Domain Admin 2014-12-01 13:03:37 +01:00
Laszlo Hornyak
3577423da9 removed executable flags from java classes
Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2014-11-23 19:49:01 +01:00
Rajani Karuturi
736ff5f8e5 Fixed CLOUDSTACK-7303 [LDAP] while importing ldap users, update the user info if it already exists in cloudstack 2014-08-11 17:54:31 +05:30
Min Chen
ba848087f8 Disable IAM feature from 4.4 release. 2014-05-22 18:27:08 -07:00
Min Chen
3314e11b70 CLOUDSTACK-6569: IAM - Regular user is able to listNetworks of another
user in the same domain , by passing account and domainId.
2014-05-02 14:58:11 -07:00
Rajani Karuturi
f4779b4d0c Fixed CLOUDSTACK-6509 Cannot import multiple LDAP/AD users into a cloudstack account
Conflicts:
	api/src/com/cloud/user/AccountService.java
	plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
	plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java

Signed-off-by: Koushik Das <koushik@apache.org>
2014-04-29 14:49:06 +05:30
Prachi Damle
9514c9e045 CLOUDSTACK-6349: IAM - No error message presented to the user , when
invalid password is provided.

- AccountManager now works using accountId instead of accountType in
following methods too:
- isResourceDomainAdmin()
- isAdmin()
2014-04-28 11:10:50 -07:00
Min Chen
da13165743 Change AccountManagerImpl.checkAccess to invoke SecurityChecker
interface that takes multiple controlled entities.
2014-04-17 17:53:01 -07:00
Min Chen
94ebc90877 Remove usage of sameOwner checkAccess invocation, and convert to
OperateEntry IAM check.
2014-04-04 16:38:29 -07:00
Prachi Damle
d9696b26e1 After merge, fix isRootAdmin() calls to use accountId instead of type 2014-03-13 13:28:40 -07:00
Min Chen
99bdc8d875 Merge branch 'master' into rbac. 2014-03-13 11:05:03 -07:00
Alena Prokharchyk
7b0c5cfcbe Removed unused methods from BaseCmd class. Moved some helper methods to AccountManagerImpl class 2014-03-07 11:33:10 -08:00
Prachi Damle
96a64b933e - Adding OperateEntry during loading of commands
- Replace ListEntry By OperateEntry
- ApiDispatcher should pass on the API name
2014-01-23 17:50:59 -08:00
Min Chen
929fbabaa2 Merge branch 'master' into rbac. 2014-01-17 14:37:08 -08:00
Alex Huang
d620df2bdd Reformatted all of the code. 2013-11-21 06:15:26 -08:00
Prachi Damle
e0d2423f06 Refactoring account_type for Domain_Admin and Normal_User types 2013-11-20 16:53:59 -08:00
Alex Huang
8d62744681 Reformat all source code. Added checkstyle to check the source code 2013-11-20 07:26:53 -08:00
Min Chen
fce2aad23d WIP For APIs related to ACL Roles. 2013-09-26 11:22:43 -07:00
Prachi Damle
aba54356d5 Account_Type Refactoring for Root Admin Role
- change the AccountService::isRootAdmin(short) to  isRootAdmin(long accountId);
- Change all callers
- Change all places that check the account.getType() directly to call the AccountManagerImpl.
2013-09-24 15:31:09 -07:00
Alena Prokharchyk
1300fc8128 AccountManager/Service: reduced visibility for methods that are called only from AccountManagerImpl itself 2013-05-30 11:18:32 -07:00
Kishan Kavala
2dd31f331d CLOUDSTACK-1636: Removed the concept of owner region.
Removed region_id from user/account and domain tables.
Removed forwarding of api calls to owner region.
Removed api_key and secret_key from region table.
Included related DB upgrade changes.
2013-03-14 11:53:40 +05:30
Kishan Kavala
e37fdce125 CLOUDSTACK-241: Removed API based account sync. Removed all the related API changes and RegionsAPIUtil.
Converted tabs to spaces in the related files.
Verified account, user and domain APIs.
2013-02-26 14:21:21 +05:30
Kelven Yang
7b75f0d990 Sync master to javelin one more time 2013-02-01 11:37:33 -08:00
Kishan Kavala
8b1a5b1de2 - Separated RegionServiceImpl and RegionManagerImpl
- Added comments
- Changed package name to org.apache.cloudstack.region
2013-01-31 18:08:20 +05:30
Kishan Kavala
def9fd1f2e remove finduser, findaccount, finddomain APIs 2013-01-28 17:04:25 +05:30
Kishan Kavala
1f57d925eb Apply API refactoring changes. Make changes to Regions API to work with new code 2013-01-25 18:41:59 +05:30
Alex Huang
fe6f0457d5 fixed unit tests from merge 2013-01-18 15:58:55 -08:00
Rohit Yadav
1425736c19 AccountManager: Add method to translate account type to role type
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 15:55:01 -08:00
Rohit Yadav
ed0637b8c2 api: Refactor move acl to org.apache.cloudstack
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-06 15:30:58 -08:00
Min Chen
ebfb90e217 Create DB view for Account to speed up ListAccountsCmd, and add missing async job information for some response objects.
Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-02 17:38:58 -08:00
Min Chen
c167ad45e3 Move view based VO and Dao classes to cloud-server module to hide the
details from API client, also extract query related methods into
QueryService interface.
2012-12-14 10:47:58 -08:00
Min Chen
c83323fea7 api: Refactoring ListUsersCmd and UserResponse.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-10 17:45:40 -08:00
Rohit Yadav
af28c06998 api: move and group all under command, org.apache.cloudstack.command.*
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-07 18:30:54 -08:00
Rohit Yadav
e763fd7d36 api_refactor: move userkeys api to admin pkg
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-06 10:59:26 -08:00
Rohit Yadav
1b1d91dc4f api_refactor: move admin level account apis to admin pkg
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-06 10:25:20 -08:00
Rohit Yadav
ceddaf122c api_refactor: refactor user apis
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-05 14:55:58 -08:00
Rohit Yadav
9a0df30766 api_refactor: refactor account apis
- Fix refactored apis, fix mappings in commands*.in
- Fix comments etc.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-03 23:42:13 -08:00
Rohit Yadav
5e0501d116 api_refactor: refactor project apis
- Fix refactored apis in commands*.in
- Fix comments etc.
- Expand tabs, remove trailing whitespace
- Fix trailing whitespaces for all *.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-03 22:10:32 -08:00
Kishan Kavala
f0f33bf4da Added Mock ApiServer, Regions API calls with api keys 2012-10-17 14:16:36 +05:30
Alena Prokharchyk
8f2d9a09e5 CLOUDSTACK-332: intermediate checkin fixing count parameter in listCommands
Fixes the count in commands:

listVolumes
listVirtualMachines
listSnapshots
listRouters
listFirewallRules
listPortForwardingRules
listLoadBalancerRules
listIpForwardingRules
listAccounts
listUsers
listDomains
listDomainChildren
listPublicIpAddresses
listAlerts
listAsyncJobs
listRemoteAccessVpns
listVpnUsers
listTags
listPrivateGateways
listNetworkACLs
listStaticRoutes

Conflicts:

	api/src/com/cloud/api/commands/ListVMsCmd.java
	api/src/com/cloud/api/commands/ListVolumesCmd.java
	api/src/com/cloud/network/lb/LoadBalancingRulesService.java
	server/src/com/cloud/network/firewall/FirewallManagerImpl.java
	server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
	server/src/com/cloud/network/rules/RulesManagerImpl.java
	server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
	server/src/com/cloud/network/vpc/VpcManagerImpl.java
	server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
	server/src/com/cloud/tags/TaggedResourceManagerImpl.java
2012-10-12 13:58:59 -07:00
Kishan Kavala
89779cceb8 Merge branch 'master' into regions
Conflicts:
	api/src/com/cloud/api/ApiConstants.java
	api/src/com/cloud/api/ResponseGenerator.java
	client/tomcatconf/commands.properties.in
	core/src/com/cloud/user/UserVO.java
	server/src/com/cloud/api/ApiResponseHelper.java
	server/src/com/cloud/configuration/DefaultComponentLibrary.java
	server/src/com/cloud/user/AccountManagerImpl.java
	setup/db/create-schema.sql
2012-10-03 14:09:01 +05:30
Kishan Kavala
39d394a8e8 Propogate Domain and User commands 2012-09-27 16:44:12 +05:30
kishan
4ea36b82e9 propogate account changes to other Regions 2012-08-24 15:59:59 +05:30
kishan
f2bbf62d9d Added getUser API to get user details using API key. Services like S3 can user this API to authenticate. API is admin only. 2012-07-18 14:20:04 -07:00
David Nalley
c15948a3ef committing Chip Childers patches fixing licensing headers
Applying to the following directories:
* api
* deamonize
* agnet
* agent-simulator
* cloud-cli
2012-06-12 12:32:58 -04:00
frank
2f634c0913 Switch to Apache license 2012-04-03 04:50:05 -07:00
Alena Prokharchyk
3a87cf8331 Code style fixes for API package 2012-02-03 14:25:26 -08:00