Skip to content

Commit

Permalink
LDAP backend updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ziadsawalha committed Jul 20, 2011
1 parent 16c0a5e commit 1200418
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 59 deletions.
6 changes: 6 additions & 0 deletions etc/keystone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ log_file = keystone.log

# List of backends to be configured
backends = keystone.backends.sqlalchemy,keystone.backends.alterdb
#,keystone.backends.ldap

# Dictionary Maps every service to a header.Missing services would get header
# X_(SERVICE_NAME) Key => Service Name, Value => Header Name
Expand Down Expand Up @@ -64,6 +65,11 @@ backend_entities = ['Token']
# to the database.
sql_idle_timeout = 30

[keystone.backends.ldap]
ldap_url = fake://ldap.db
ldap_user = cn=Admin
ldap_password = password

[pipeline:admin]
pipeline =
urlrewritefilter
Expand Down
118 changes: 60 additions & 58 deletions keystone/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Not Yet PEP8 standardized


#API
#TODO(Yogi) Refactor all API to separate classes specific to models.
endpoint_template = None
group = None
role = None
tenant_group = None
tenant = None
token = None
user = None


# Function to dynamically set module references.
def set_value(variable_name, value):
Expand All @@ -39,6 +48,7 @@ def set_value(variable_name, value):
global user
user = value


#Base APIs
class BaseUserAPI(object):
def get_all(self):
Expand Down Expand Up @@ -123,77 +133,77 @@ def user_groups_get_all(self, user_id):
class BaseTokenAPI(object):
def create(self, values):
raise NotImplementedError

def get(self, id):
raise NotImplementedError

def delete(self, id):
raise NotImplementedError

def get_for_user(self, user_id):
raise NotImplementedError

def get_for_user_by_tenant(self, user_id, tenant_id):
raise NotImplementedError

def get_all(self):
raise NotImplementedError


class BaseTenantGroupAPI(object):
def create(self, values):
raise NotImplementedError

def is_empty(self, id):
raise NotImplementedError

def get(self, id, tenant):
raise NotImplementedError

def get_page(self, tenantId, marker, limit):
raise NotImplementedError

def get_page_markers(self, tenantId, marker, limit):
raise NotImplementedError

def update(self, id, tenant_id, values):
raise NotImplementedError

def delete(self, id, tenant_id):
raise NotImplementedError


class BaseTenantAPI(object):
def create(self, values):
raise NotImplementedError

def get(self, id):
raise NotImplementedError

def get_all(self):
raise NotImplementedError

def tenants_for_user_get_page(self, user, marker, limit):
raise NotImplementedError

def tenants_for_user_get_page_markers(self, user, marker, limit):
raise NotImplementedError

def get_page(self, marker, limit):
raise NotImplementedError

def get_page_markers(self, marker, limit):
raise NotImplementedError

def is_empty(self, id):
raise NotImplementedError

def update(self, id, values):
raise NotImplementedError

def delete(self, id):
raise NotImplementedError

def get_all_endpoints(self, tenant_id):
raise NotImplementedError

Expand All @@ -204,31 +214,31 @@ def get_role_assignments(self, tenant_id):
class BaseRoleAPI(object):
def create(self, values):
raise NotImplementedError

def get(self, id):
raise NotImplementedError

def get_all(self):
raise NotImplementedError

def get_page(self, marker, limit):
raise NotImplementedError

def ref_get_page(self, marker, limit, user_id):
raise NotImplementedError

def ref_get_all_global_roles(self, user_id):
raise NotImplementedError

def ref_get_all_tenant_roles(self, user_id, tenant_id):
raise NotImplementedError

def ref_get(self, id):
raise NotImplementedError

def ref_delete(self, id):
raise NotImplementedError

def get_page_markers(self, marker, limit):
raise NotImplementedError

Expand All @@ -239,68 +249,60 @@ def ref_get_page_markers(self, user_id, marker, limit):
class BaseGroupAPI(object):
def get(self, id):
raise NotImplementedError

def get_users(self, id):
raise NotImplementedError

def get_all(self):
raise NotImplementedError

def get_page(self, marker, limit):
raise NotImplementedError

def get_page_markers(self, marker, limit):
raise NotImplementedError

def delete(self, id):
raise NotImplementedError

def get_by_user_get_page(self, user_id, marker, limit):
raise NotImplementedError

def get_by_user_get_page_markers(self, user_id, marker, limit):
raise NotImplementedError


class BaseEndpointTemplateAPI(object):
def create(self, values):
raise NotImplementedError

def get(self, id):
raise NotImplementedError

def get_all(self):
raise NotImplementedError

def get_page(self, marker, limit):
raise NotImplementedError

def get_page_markers(self, marker, limit):
raise NotImplementedError

def endpoint_get_by_tenant_get_page(self, tenant_id, marker, limit):
raise NotImplementedError

def endpoint_get_by_tenant_get_page_markers(self, tenant_id, marker,
limit):
raise NotImplementedError

def endpoint_add(self, values):
raise NotImplementedError

def endpoint_get(self, id):
raise NotImplementedError

def endpoint_get_by_tenant(self, tenant_id):
raise NotImplementedError

def endpoint_delete(self, id):
raise NotImplementedError

endpoint_template = BaseEndpointTemplateAPI()
group = BaseGroupAPI()
role = BaseRoleAPI()
tenant_group = BaseTenantGroupAPI()
tenant = BaseTenantAPI()
token = BaseTokenAPI()
user = BaseUserAPI()
16 changes: 16 additions & 0 deletions keystone/backends/ldap/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ldap

import keystone.backends.api as top_api
import keystone.backends.models as top_models
from keystone import utils

from . import api
from . import models


def configure_backend(options):
api_obj = api.API(options)
for name in api_obj.apis:
top_api.set_value(name, getattr(api_obj, name))
for model_name in models.__all__:
top_models.set_value(model_name, getattr(models, model_name))
2 changes: 1 addition & 1 deletion keystone/backends/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Not Yet PEP8 standardized

#Current Models
UserGroupAssociation = None
UserRoleAssociation = None
Expand Down

0 comments on commit 1200418

Please sign in to comment.